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

redundant_type_annotation ignores arrays #3141

Closed
2 tasks done
theoriginalbit opened this issue Mar 12, 2020 · 9 comments · Fixed by #5389 or #5536
Closed
2 tasks done

redundant_type_annotation ignores arrays #3141

theoriginalbit opened this issue Mar 12, 2020 · 9 comments · Fixed by #5389 or #5536
Labels
bug Unexpected and reproducible misbehavior.

Comments

@theoriginalbit
Copy link

New Issue Checklist

Describe the bug

redundant_type_annotation ignores types that are arrays.

Complete output when running SwiftLint, including the stack trace and command used
Done linting! Found 0 violations, 0 serious in 47 files.

Environment

  • SwiftLint version (run swiftlint version to be sure)?
    0.39.1
  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
    brew
  • Paste your configuration file:
disabled_rules:
  - line_length
  - function_parameter_count
  - large_tuple
opt_in_rules:
  - attributes
  - file_header
  - empty_string
  - closure_spacing
  - convenience_type
  - discouraged_object_literal
  - fatal_error_message
  - force_unwrapping
  - implicitly_unwrapped_optional
  - yoda_condition
  - trailing_closure
  - redundant_type_annotation
included:
  - Source
excluded:
  - "Source/R.generated.swift"

attributes:
    always_on_same_line: ["@IBAction", "@NSManaged", "@objc"]
file_header:
    forbidden_pattern: ".?"
identifier_name:
  excluded:
    - id
trailing_comma:
  mandatory_comma: true
  • Are you using nested configurations?
    Nope
  • Which Xcode version are you using (check xcodebuild -version)?
    Xcode 11.3.1
    Build version 11C504
  • Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
$ echo "let values: [Int] = [Int]()" | swiftlint lint --no-cache --use-stdin --enable-all-rules
<nopath>:1:1: warning: Explicit ACL Violation: All declarations should specify Access Control Level keywords explicitly. (explicit_acl)
<nopath>:1:1: warning: Explicit Top Level ACL Violation: Top-level declarations should specify Access Control Level keywords explicitly. (explicit_top_level_acl)
<nopath>:1:5: warning: Prefixed Top-Level Constant Violation: Top-level constants should be prefixed by `k`. (prefixed_toplevel_constant)
Done linting! Found 3 violations, 0 serious in 1 file.
let values: [Int] = [Int]()
@marcelofabri marcelofabri added the bug Unexpected and reproducible misbehavior. label Aug 4, 2020
@stale
Copy link

stale bot commented Nov 8, 2020

This issue has been automatically marked as stale because it has not had any recent activity. Please comment to prevent this issue from being closed. Thank you for your contributions!

@stale stale bot added the wontfix Issues that became stale and were auto-closed by a bot. label Nov 8, 2020
@theoriginalbit
Copy link
Author

Please don't close stale bot.

@stale stale bot removed the wontfix Issues that became stale and were auto-closed by a bot. label Nov 8, 2020
@stale
Copy link

stale bot commented Jan 7, 2021

This issue has been automatically marked as stale because it has not had any recent activity. Please comment to prevent this issue from being closed. Thank you for your contributions!

@stale stale bot added the wontfix Issues that became stale and were auto-closed by a bot. label Jan 7, 2021
@theoriginalbit
Copy link
Author

c'mon stale bot. be kind.

@stale stale bot closed this as completed Jan 15, 2021
@theoriginalbit
Copy link
Author

@jpsim jpsim removed the wontfix Issues that became stale and were auto-closed by a bot. label Feb 23, 2021
@jpsim jpsim reopened this Feb 23, 2021
@jpsim
Copy link
Collaborator

jpsim commented Feb 23, 2021

Haha, sorry I ended up changing my mind on stalebot (#3529) but thanks for taking this with some amount of levity 😄. Let's keep this open. This is a bug, I haven't looked into fixing but I suspect it'll require using more of a tokenization approach to detect types involved rather than what's likely a regex here.

@theoriginalbit
Copy link
Author

yeah no worries. thanks for re-opening 😄

@UksusoFF
Copy link

UksusoFF commented Mar 24, 2021

Same trouble with

let value: Int = 5

Seems it's can be fixed as well as #3438

@revolter
Copy link
Contributor

revolter commented May 4, 2021

Same for strings:

static var storyboardName: String = "MyStoryboard"

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