sonar-swift icon indicating copy to clipboard operation
sonar-swift copied to clipboard

Added swiftlint custom rules extraction from a .swiftlint.yml file

Open Pierre-Loup opened this issue 7 years ago • 4 comments

Hi,

I added this feature : custom swiftlint rule extraction from a local .swiftlint.yml

custom_rules:
  pirates_beat_ninjas: # rule identifier
    included: ".*\\.swift" # regex that defines paths to include during linting. optional.
    excluded: ".*Test\\.swift" # regex that defines paths to exclude during linting. optional
    name: "Pirates Beat Ninjas" # rule name. optional.
    regex: "([n,N]inja)" # matching pattern
    match_kinds: # SyntaxKinds to match. optional.
      - comment
      - identifier
    message: "Pirates are better than ninjas." # violation message. optional.
    severity: error # violation severity. optional.
  no_hiding_in_strings:
    regex: "([n,N]inja)"
    match_kinds: string

I found no better solution to do this has swiftlint rules must be described before the plugin packaging.

Pierre-Loup avatar Mar 28 '18 15:03 Pierre-Loup

we should merge this as well.

singh88 avatar Apr 20 '18 21:04 singh88

Hi,

Did you get this working ? Because you upgraded the Groovy script to generate rule files, but once the plugin is compiled, they cannot be changed... So I don't understand how this would work 'dynamically'...

Gilles

zippy1978 avatar Aug 23 '18 07:08 zippy1978

Hi,

It doen't work "dynamicaly". You have to rebuild the plugin.

Pierre-Loup avatar Aug 23 '18 12:08 Pierre-Loup

Hi @Pierre-Loup,

Does this mean someone who want to integrate his custom SwiftLint rule(s), will have to rebuild the plugin each time?

I don't think we can integrate this feature, to be honest.

gaelfoppolo avatar Aug 10 '19 17:08 gaelfoppolo