Giter Site home page Giter Site logo

rules_swiftlint's People

Contributors

thii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rules_swiftlint's Issues

Error: 'OutputGroupInfo' value has no field or method '_validation'

I followed all the instructions in the README but I'm receiving an error when I try to build with validations:

bazelisk build //BazelSample:BuildTest
Starting local Bazel server and connecting to it...
ERROR: /Users/andre.alves/Documents/Works/swiftlint-sample-bug/BazelSample/BUILD:17:14: in @com_github_thii_rules_swiftlint//swiftlint/private:aspects.bzl%swiftlint_aspect aspect on swift_library rule //BazelSample:CocktailDBInterface: 
Traceback (most recent call last):
	File "/private/var/tmp/_bazel_andre.alves/47bd25c17eef0078807a5b06795f8181/external/com_github_thii_rules_swiftlint/swiftlint/private/aspects.bzl", line 79, column 27, in _swiftlint_aspect_impl
		d[OutputGroupInfo]._validation
Error: 'OutputGroupInfo' value has no field or method '_validation'
Available attributes: _hidden_top_level_INTERNAL_
ERROR: Analysis of aspects '[@com_github_thii_rules_swiftlint//swiftlint:defs.bzl%swiftlint_aspect] with parameters {} on //BazelSample:BuildTest' failed; build aborted: Analysis of target '//BazelSample:CocktailDBInterface' failed
INFO: Elapsed time: 8.825s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (70 packages loaded, 854 targets configured)

I created a sample project to help (Bazel 6.0.0):

rules_swiftlint_sample.zip

BazelSample/BUILD

ios_framework(
    name = "BuildTest",
    bundle_id = "com.test.frameworks.BuildTest",
    deps = [":CocktailDBInterface"],
    families = [
        "iphone",
        "ipad"
    ],
    infoplists = ["Info.plist"],
    minimum_os_version = "14.0",
    visibility = ["//visibility:public"],
)

swift_library(
    name = "CocktailDBInterface",
    module_name = "CocktailDBInterface",
    visibility = ["//visibility:public"],
    srcs = glob(["CocktailDBInterface/Sources/**/*.swift"]),
    deps = ["//Pods:Cartography"],
    tags = ["manual"],
)

Pods/BUILD

apple_static_xcframework_import(
    name = "Cartography",
    xcframework_imports = glob(["Cartography/Frameworks/Cartography.xcframework/**"]),
    visibility = ["//visibility:public"],
)

Command

bazel build //BazelSample:BuildTest

I noticed that the error doesn't happen if I remove the line deps = ["//Pods:Cartography"].

Error: Fails to run SwiftLint validation alone for multiple targets

When I try to run SwiftLint validation alone in the way described in README, I've got the following error.
Are there any other ways?

  • Config
build:swiftlint --aspects=@com_github_thii_rules_swiftlint//swiftlint:defs.bzl%swiftlint_aspect
build:swiftlint --output_groups=_validation

build:swiftlint_default --config=swiftlint
build:swiftlint_default --@com_github_thii_rules_swiftlint//swiftlint:config=//:swiftlint_config
  • Command
bazel build --config=swiftlint_default //xxx/...
  • Error
(18:38:57) ERROR: /Users/xxx/BUILD:x:x: Output group _validation provided twice
(18:38:57) ERROR: Analysis of aspects '[@com_github_thii_rules_swiftlint//swiftlint:defs.bzl%swiftlint_aspect] with parameters {} on //xxx:xxx' failed; build aborted: Output group _validation provided twice

ERROR: Confliction actions for files with same name

Validation fails when modules have files with the same name:

bazelisk build //BazelSample:BuildTest
ERROR: file 'BazelSample/Something.swift.validation' is generated by these conflicting actions:
Label: //BazelSample:CocktailDBInterface, //BazelSample:NetworkInterface
Aspects: [@com_github_thii_rules_swiftlint//swiftlint/private:aspects.bzl%swiftlint_aspect]
RuleClass: swift_library rule
JavaActionClass: class com.google.devtools.build.lib.analysis.actions.StarlarkAction
Configuration: a6fee4f05da9434dc8822a8a1df8666b42153fdc0f0c13f71cf37f456e8d26c2
Mnemonic: SwiftLint
Action key: 4272cb2a00dc5a5c7d56172ab11851c91941e40f7b5ea66a9a61547db49e6e0e, ecd1db0710ba7f91997b29b605f18b9ece4310e2b2f59bd0d23960ed734d44b4
Progress message: Linting 'BazelSample/CocktailDBInterface/Sources/Something.swift', Linting 'BazelSample/NetworkInterface/Sources/Something.swift'
Action describeKey: Linting 'BazelSample/CocktailDBInterface/Sources/Something.swift'
  Environment variables taken from the client environment: LD_LIBRARY_PATH
  Environment variables taken from the client environment: PATH
  Argument: bazel-out/darwin_arm64-opt-exec-2B5CBBC6-ST-521287fc850f/bin/external/com_github_thii_rules_swiftlint/tools/swiftlint_wrapper
  Argument: external/SwiftLint/swiftlint
  Argument: bazel-out/ios-sim_arm64-min14.0-applebin_ios-ios_sim_arm64-fastbuild-ST-b50dc75d2840/bin/BazelSample/Something.swift.validation
  Argument: lint
  Argument: --config
  Argument: external/com_github_thii_rules_swiftlint/swiftlint/default.swiftlint.yml
  Argument: --no-cache
  Argument: --quiet
  Argument: BazelSample/CocktailDBInterface/Sources/Something.swift
, Linting 'BazelSample/NetworkInterface/Sources/Something.swift'
  Environment variables taken from the client environment: LD_LIBRARY_PATH
  Environment variables taken from the client environment: PATH
  Argument: bazel-out/darwin_arm64-opt-exec-2B5CBBC6-ST-521287fc850f/bin/external/com_github_thii_rules_swiftlint/tools/swiftlint_wrapper
  Argument: external/SwiftLint/swiftlint
  Argument: bazel-out/ios-sim_arm64-min14.0-applebin_ios-ios_sim_arm64-fastbuild-ST-b50dc75d2840/bin/BazelSample/Something.swift.validation
  Argument: lint
  Argument: --config
  Argument: external/com_github_thii_rules_swiftlint/swiftlint/default.swiftlint.yml
  Argument: --no-cache
  Argument: --quiet
  Argument: BazelSample/NetworkInterface/Sources/Something.swift

PrimaryInput: File:[/Users/andre.alves/Documents/Works/swiftlint-sample-bug[source]]BazelSample/CocktailDBInterface/Sources/Something.swift, File:[/Users/andre.alves/Documents/Works/swiftlint-sample-bug[source]]BazelSample/NetworkInterface/Sources/Something.swift
PrimaryOutput: File:[[<execution_root>]bazel-out/ios-sim_arm64-min14.0-applebin_ios-ios_sim_arm64-fastbuild-ST-b50dc75d2840/bin]BazelSample/Something.swift.validation
ERROR: com.google.devtools.build.lib.actions.MutableActionGraph$ActionConflictException: for BazelSample/Something.swift.validation, previous action: action 'Linting 'BazelSample/NetworkInterface/Sources/Something.swift'', attempted action: action 'Linting 'BazelSample/CocktailDBInterface/Sources/Something.swift''

INFO: Elapsed time: 0.053s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)

Sample:

rules_swiftlint_conflict_bug.zip

Integration with rules_xcodeproj

Hi,

is there any docs or guide to integrate this with rules_xcodeproj so we can surface warning and violation error in Xcode? I've tried it and when it does give error or violation report on terminal output, it doesn't show anything on Xcode.

Thanks.

Feature Request: Apply different settings per directory

Motivation

We have multiple products for different organizations in our group in a single monorepo, so in addition to the common SwiftLint configuration, each organization may have additional SwiftLint configs. Also, there're some directories to which we can't apply lint rules as well.
rules_swiftlint can be configured globally with a single SwiftLint config or with multiple SwiftLint configs using Bazel configs, but it's even more convenient if it's possible to flexibly apply different configs based on some conditions like directories.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.