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

Lint output is incomplete at times #3214

Closed
2 tasks done
franciscodua opened this issue May 22, 2020 · 2 comments · Fixed by #3283
Closed
2 tasks done

Lint output is incomplete at times #3214

franciscodua opened this issue May 22, 2020 · 2 comments · Fixed by #3283
Labels
bug Unexpected and reproducible misbehavior.

Comments

@franciscodua
Copy link

New Issue Checklist

Describe the bug

When running the swiftlint CLI (lint option), the output is not complete. The behavior is not consistent, sometimes it ends and outputs Done linting! Found 7 violations, 5 serious in 2 files., other times it ends mid-issue.

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint --reporter json -- closing_brace2.swift dynamic_inline2.swift
Loading configuration from '.swiftlint.yml'
Linting Swift files at paths closing_brace2.swift, dynamic_inline2.swift
Linting 'closing_brace2.swift' (1/2)
Linting 'dynamic_inline2.swift' (2/2)
[
  {
    "character" : 14,
    "file" : "\/src\/closing_brace2.swift",
    "line" : 6,
    "reason" : "Closing brace with closing parenthesis should not have any whitespaces in the middle.",
    "rule_id" : "closing_brace",
    "severity" : "Warning",
    "type" : "Closing Brace Spacing"
  },
  {
    "character" : 14,
    "file" : "\/src\/closing_brace2.swift",
    "line" : 8,
    "reason" : "Closing brace with closing parenthesis should not have any whitespaces in the middle.",
    "rule_id" : "closing_brace",
    "severity" : "Warning",
    "type" : "Closing Brace Spacing"
  },
  {
    "character" : 31,
    "file" : "\/src\/dynamic_inline2.swift",
    "line" : 10,
    "reason" : "Avoid using 'dynamic' and '@inline(__always)' together.",
    "rule_id" : "dynamic_inline",
    "severity" : "Error",
    "type" : "Dynamic Inline"
  },
  {
    "character" : 38,
    "file" : "\/src\/dynamic_inline2.swift",
    "line" : 14,
    "reason" : "Avoid using 'dynamic' and '@inline(__always)' together.",
    "rule_id" : "

The files used in this analysis are:
dynamic_inline.swift:

//#Patterns: dynamic_inline

//#Issue: {"severity": "Info", "line": 10, "patternId": "dynamic_inline"}
//#Issue: {"severity": "Info", "line": 14, "patternId": "dynamic_inline"}
//#Issue: {"severity": "Info", "line": 18, "patternId": "dynamic_inline"}
//#Issue: {"severity": "Info", "line": 23, "patternId": "dynamic_inline"}
//#Issue: {"severity": "Info", "line": 29, "patternId": "dynamic_inline"}

    class C {
    @inline(__always) dynamic func f() {}
    }

    class C {
    @inline(__always) public dynamic func f() {}
    }

    class C {
    @inline(__always) dynamic internal func f() {}
    }

    class C {
    @inline(__always)
    dynamic func f() {}
    }

    class C {
    @inline(__always)
    dynamic
    func f() {}
    }

And closing_brace.swift:

//#Patterns: closing_brace

//#Issue: {"severity": "Info", "line": 6, "patternId": "closing_brace"}
//#Issue: {"severity": "Info", "line": 8, "patternId": "closing_brace"}

    [].map({ } )

    [].map({ }	)

Environment

  • SwiftLint version (run swiftlint version to be sure)?
    0.39.2
  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
    Running analysis in Docker image norionomura/swiftlint:0.39.2_swift-5.2.4
  • Paste your configuration file:
whitelist_rules:
  - closing_brace
  - dynamic_inline
  • Are you using nested configurations?
    No
  • Which Xcode version are you using (check xcodebuild -version)?
    Docker container doesn't have xcodebuild
  • Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
    to quickly test if your example is really demonstrating the issue. If your example is more
    complex, you can use swiftlint lint --path [file here] --no-cache --enable-all-rules.
    The issue happens for the files I shared above if I run the analysis a few times. I would say 1 out of 5.

Note:
I don't know that much about swift yet. But I was thinking if this problem could be related to the async nature of the print? Is it possible that the print is not completing when the tool finishes executing?

Thanks for reading this long issue.

@franciscodua
Copy link
Author

Hi
Any news on this issue? Do you need more information?

@marcelofabri
Copy link
Collaborator

This is probably because we don't use atexit_b on Linux: 8c17145

@marcelofabri marcelofabri added the bug Unexpected and reproducible misbehavior. label Aug 5, 2020
marcelofabri added a commit that referenced this issue Aug 5, 2020
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

Successfully merging a pull request may close this issue.

2 participants