Linting CRLF encoded files causes an empty line to be inserted between each line of code
Open
Nobody has claimed this yet.
bug
- Dominant language
- Swift
- Stars
- 19.7k
- Forks
- 2.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
Issue Description
Linting CRLF encoded files causes an empty line to be inserted between each line of code
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint autocorrect
Environment
- SwiftLint version 0.21.0
- Installation method used Homebrew
- Paste your configuration file:
# comments_space: # From https://github.com/brandenr/swiftlintconfig
# name: "Space After Comment"
# regex: '(^ *//\w+)'
# message: "There should be a space after //"
# severity: error
#
# force_https: # From https://github.com/Twigz/Game
# name: "Force HTTPS over HTTP"
# regex: "((?i)http(?!s))"
# match_kinds: string
# message: "HTTPS should be favored over HTTP"
# severity: warning
#
# double_space: # From https://github.com/IBM-Swift/Package-Builder
# include: "*.swift"
# name: "Double space"
# regex: '([a-z,A-Z] \s+)'
# message: "Double space between keywords"
# match_kinds: keyword
# severity: warning
disabled_rules: # rule identifiers to exclude from running
#Errors
- force_try
- force_cast
- line_length
- file_length
- type_body_length
- function_body_length
- identifier_name
- cyclomatic_complexity
- large_tuple
#Warnings
- trailing_comma # Keep this exclusion
- empty_parentheses_with_trailing_closure
- function_parameter_count
- vertical_whitespace # This rule is confused by Runes it seems
opt_in_rules: # some rules are only opt-in
# Find all the available rules by running:
# swiftlint rules
included: # paths to include during linting. `--path` is ignored if present.
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods
- fastlane
#reporter: "xcode" # reporter type (xcode, json, csv, checkstyle)
- Are you using nested configurations? No
- Which Xcode version are you using (check
xcode-select -p)? 8.3.3 - Do you have a sample example that shows the issue? No. Create any CRLF encoded swift file.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the swiftlint autocorrect entry point and trace how CRLF-encoded Swift files are read and rewritten. Reproduce the issue with a CRLF-encoded file, then verify that autocorrection no longer inserts an empty line between each line of code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100