realm / realm/SwiftLint

Linting CRLF encoded files causes an empty line to be inserted between each line of code

Open
#1,786 15 comments 1 reaction 0 assignees View on GitHub

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
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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.