thii / rules_swiftlint Goto Github PK
View Code? Open in Web Editor NEWRun SwiftLint in your Bazel build efficiently.
License: MIT License
Run SwiftLint in your Bazel build efficiently.
License: MIT License
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):
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"]
.
Since we're passing file paths directly, the excluded
configuration is being ignored.
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?
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
bazel build --config=swiftlint_default //xxx/...
(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
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:
Hi!
The http_archive
name doesn't match the rest of the snippet (and other parts of the documentation)
https://github.com/thii/rules_swiftlint/releases/tag/0.2.0
It's currently rules_swiftlint
but it should be com_github_thii_rules_swiftlint
.
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.