realm / realm/SwiftLint

Excluded Pods not working and linting pods files even after adding it in excluded.

Open
#5,067 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

integration
Dominant language
Swift
Stars
19.7k
Forks
2.3k
Avg merge
1d 1h
Merged PRs (30d)
11

Description

New Issue Checklist
Describe the bug

I have followed all steps mention on SwiftLint Github Link and installed SwiftLint in Xcode.
I have added .swiftlint.yml file also and added pods in excluded but when I am building my project it's showing me errors of my pods files also which i have already given in excluded.

Screenshot 2023-06-19 at 3 13 59 PM
Environment
  • SwiftLint version (run swiftlint version to be sure)? Version : 0.52.2
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? CocoaPods
  • Paste your configuration file:
# By default, SwiftLint uses a set of sensible default rules you can adjust:
disabled_rules: # rule identifiers turned on by default to exclude from running
  - colon
  - comma
  - control_statement
  
opt_in_rules: # some rules are turned off by default, so you need to opt-in
  - empty_count # Find all the available rules by running: `swiftlint rules`
  - line_length: 500
  - trailing_semicolon
  - unused_ivars
  - empty_delegate

# Alternatively, specify all rules explicitly by uncommenting this option:
# only_rules: # delete `disabled_rules` & `opt_in_rules` if using this
#   - empty_parameters
#   - vertical_whitespace

analyzer_rules: # Rules run by `swiftlint analyze`
  - explicit_self

included: # paths to include during linting. `--path` is ignored if present.
  - Source
  - Sources/**/*.{h,m}
  
excluded: # paths to ignore during linting. Takes precedence over `included`.
  - Carthage
  - Pods
  - Pods/

# If true, SwiftLint will not fail if no lintable files are found.
allow_zero_lintable_files: false

# configurable rules can be customized from this configuration file
# binary rules can set their severity level
force_cast: warning # implicitly
force_try:
  severity: warning # explicitly
# rules that have both warning and error levels, can set just the warning level
# implicitly
line_length: 500
# they can set both implicitly with an array
type_body_length:
  - 300 # warning
  - 400 # error
# or they can set both explicitly
file_length:
  warning: 500
  error: 1200
# naming rules can set warnings/errors for min_length and max_length
# additionally they can set excluded names
type_name:
  min_length: 4 # only warning
  max_length: # warning and error
    warning: 40
    error: 50
  excluded: iPhone # excluded via string
  allowed_symbols: ["_"] # these are allowed in type names
identifier_name:
  min_length: # only min_length
    error: 4 # only error
  excluded: # excluded via string array
    - id
    - URL
    - GlobalAPIKey
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, codeclimate, junit, html, emoji, sonarqube, markdown, github-actions-logging, summary)

  • Are you using nested configurations? No
    If so, paste their relative paths and respective contents.
  • Which Xcode version are you using (check xcodebuild -version)? Xcode version : 14.3
  • Do you have a sample that shows the issue? Answer : Yes
    Find below attached screenshot which is showing that above .yml file i have added line_length: 500 and in excluded added pods then also it's linting file which is inside pods and showing errors.
excluded: 
  - Carthage
  - Pods
  - Pods/
Screenshot 2023-06-19 at 3 23 27 PM

Can you please guide me how to solve this issue and where i am doing wrong ?

Thank you

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported .swiftlint.yml and reproduce the lint run through the CocoaPods/Xcode integration using SwiftLint 0.52.2 and Xcode 14.3. Trace which configuration and paths the invocation uses, then verify that files under Pods no longer produce diagnostics while the Source paths remain linted.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.