Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Rules can't be reconfigured in a child config #3477

Closed
fredpi opened this issue Dec 22, 2020 · 5 comments
Closed

Custom Rules can't be reconfigured in a child config #3477

fredpi opened this issue Dec 22, 2020 · 5 comments
Assignees
Labels
bug Unexpected and reproducible misbehavior.

Comments

@fredpi
Copy link
Collaborator

fredpi commented Dec 22, 2020

As mentioned by @mgray88, there exists an issue where custom_rules can't be reconfigured in a child configuration. E. g. when reconfiguring the severity of a custom rule, one gets two warnings: For the old severity as well as the new severity, instead of just one warning with the reconfigured severity.

Example:

parent.yml:

custom_rules:
  no_hiding_in_strings:
    regex: "([nN]inja)"
    match_kinds: string
    severity: warning

.swiftlint.yml:

parent_config: parent.yml

custom_rules:
  no_hiding_in_strings:
    regex: "([nN]inja)"
    match_kinds: string
    severity: error

Result when running SwiftLint:

swiftlint
Linting Swift files in current working directory
Linting 'A.swift' (1/1)
FileName:1:21: error: no_hiding_in_strings Violation: Regex matched. (no_hiding_in_strings)
FileName:1:21: warning: no_hiding_in_strings Violation: Regex matched. (no_hiding_in_strings)
Done linting! Found 2 violations, 1 serious in 1 file.

custom-rules-issue.zip

SwiftLint Version 0.42.0

@fredpi fredpi added the bug Unexpected and reproducible misbehavior. label Dec 22, 2020
@fredpi fredpi self-assigned this Dec 22, 2020
fredpi added a commit that referenced this issue Dec 22, 2020
@CraigSiemens
Copy link
Contributor

It also appears the disabling a custom rule in a child config no longer works as well.

disabled_rules:
- my_custom_rule

produces this warning

warning: 'my_custom_rule' is not a valid rule identifier

@fredpi
Copy link
Collaborator Author

fredpi commented Jan 4, 2021

@CraigSiemens There's a separate issue for that (#3472) and also an active PR addressing it (#3473). Sorry for the inconvenience!

fredpi added a commit that referenced this issue Jan 14, 2021
@fredpi
Copy link
Collaborator Author

fredpi commented Jan 15, 2021

Closed via #3473.

@fredpi fredpi closed this as completed Jan 15, 2021
@jpsim
Copy link
Collaborator

jpsim commented Jan 22, 2021

UnfortunatelyI had to revert #3473 in #3503.

@jpsim jpsim reopened this Jan 22, 2021
DwayneCoussement pushed a commit to DwayneCoussement/SwiftLint that referenced this issue Jan 27, 2021
DwayneCoussement added a commit to DwayneCoussement/SwiftLint that referenced this issue Jan 27, 2021
Separate custom rules merging & filtering to avoid misleading warnings

Add changelog entry

Fix custom_rules merging when a configuration is based on only_rules

Fix if statement formatting

Fix changelog

[realm#3477] Fix bug that prevented the reconfiguration of a custom rule in a child config

Add newline at end of yml test file

[Analyze] Support compile commands with relative paths (realm#3501)

* [Analyze] Support compile commands with relative paths

* Add changelog entry

And made small formatting edits to other recent entries.

Update rule: uiimage_require_bundle
DwayneCoussement pushed a commit to DwayneCoussement/SwiftLint that referenced this issue Feb 1, 2021
commit bbf1ad4
Author: JP Simard <jp@jpsim.com>
Date:   Fri Jan 29 13:59:28 2021 -0500

    [ExplicitSelfRule] Fix violation location and misplaced corrections (realm#3507)

commit 59eb887
Author: Otavio Cordeiro <otaviocc@users.noreply.github.com>
Date:   Fri Jan 29 18:30:57 2021 +0100

    Add opt-in rule discouraged_assert (realm#3506)

    Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>

commit 6a38b15
Author: JP Simard <jp@jpsim.com>
Date:   Fri Jan 22 13:31:05 2021 -0500

    Revert "Merge pull request realm#3473 from realm/feature/3472-fix-custom-rules-merging" (realm#3503)

    This reverts commit 537e53f, reversing
    changes made to ba49f7d.

commit 6de5771
Author: JP Simard <jp@jpsim.com>
Date:   Fri Jan 22 12:44:30 2021 -0500

    [Analyze] Support compile commands with relative paths (realm#3501)

    * [Analyze] Support compile commands with relative paths

    * Add changelog entry

    And made small formatting edits to other recent entries.

commit 537e53f
Merge: ba49f7d 22d25da
Author: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com>
Date:   Fri Jan 15 11:53:17 2021 +0100

    Merge pull request realm#3473 from realm/feature/3472-fix-custom-rules-merging

    Multiple Fixes for custom rules

commit 22d25da
Author: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com>
Date:   Fri Jan 15 00:14:50 2021 +0100

    Add newline at end of yml test file

commit 2d17045
Author: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com>
Date:   Tue Dec 22 19:41:40 2020 +0100

    [realm#3477] Fix bug that prevented the reconfiguration of a custom rule in a child config

commit a39e72e
Author: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com>
Date:   Mon Dec 21 12:40:53 2020 +0100

    Fix changelog

commit 56e4f17
Author: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com>
Date:   Sun Dec 20 00:52:17 2020 +0100

    Fix if statement formatting

commit 5bffc77
Author: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com>
Date:   Sun Dec 20 00:44:49 2020 +0100

    Fix custom_rules merging when a configuration is based on only_rules

commit e3e169b
Author: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com>
Date:   Sat Dec 19 00:11:13 2020 +0100

    Add changelog entry

commit 256288a
Author: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com>
Date:   Sat Dec 19 00:03:13 2020 +0100

    Separate custom rules merging & filtering to avoid misleading warnings
DwayneCoussement added a commit to DwayneCoussement/SwiftLint that referenced this issue Feb 1, 2021
Remove trailing comma

Separate custom rules merging & filtering to avoid misleading warnings

Add changelog entry

Fix custom_rules merging when a configuration is based on only_rules

Fix if statement formatting

Fix changelog

[realm#3477] Fix bug that prevented the reconfiguration of a custom rule in a child config

Add newline at end of yml test file

[Analyze] Support compile commands with relative paths (realm#3501)

* [Analyze] Support compile commands with relative paths

* Add changelog entry

And made small formatting edits to other recent entries.

Update rule: uiimage_require_bundle
DwayneCoussement added a commit to DwayneCoussement/SwiftLint that referenced this issue Feb 2, 2021
Remove trailing comma

Separate custom rules merging & filtering to avoid misleading warnings

Add changelog entry

Fix custom_rules merging when a configuration is based on only_rules

Fix if statement formatting

Fix changelog

[realm#3477] Fix bug that prevented the reconfiguration of a custom rule in a child config

Add newline at end of yml test file

[Analyze] Support compile commands with relative paths (realm#3501)

* [Analyze] Support compile commands with relative paths

* Add changelog entry

And made small formatting edits to other recent entries.

Update rule: uiimage_require_bundle
@jpsim
Copy link
Collaborator

jpsim commented Feb 25, 2021

Fixed again in #3538

@jpsim jpsim closed this as completed Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

No branches or pull requests

3 participants