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

Appease the rubocop static code analyzer #71

Open
specious opened this issue Oct 10, 2017 · 0 comments
Open

Appease the rubocop static code analyzer #71

specious opened this issue Oct 10, 2017 · 0 comments

Comments

@specious
Copy link
Member

Running rubocop on the latest code on our production branch (9e9e521), I see 24 (ostensibly superficial) offenses. Looks like most of them have to do with double quoted string literals:

Inspecting 71 files
....................................C.................W................

Offenses:

config/initializers/customization.rb:2:42: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
AdoptAThing::Application.config.x.city = "Durham"
                                         ^^^^^^^^
config/initializers/customization.rb:2:50: C: Final newline missing.
AdoptAThing::Application.config.x.city = "Durham"
                                                 
lib/tasks/data.rake:9:21: C: Freeze mutable objects assigned to constants.
    TYPES_TO_SKIP = ["HEADWALL", "END SECTION"]
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/tasks/data.rake:9:22: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
    TYPES_TO_SKIP = ["HEADWALL", "END SECTION"]
                     ^^^^^^^^^^
lib/tasks/data.rake:9:34: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
    TYPES_TO_SKIP = ["HEADWALL", "END SECTION"]
                                 ^^^^^^^^^^^^^
lib/tasks/data.rake:17:28: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
    output_csv = File.open("durham_drains.csv", "w")
                           ^^^^^^^^^^^^^^^^^^^
lib/tasks/data.rake:17:49: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
    output_csv = File.open("durham_drains.csv", "w")
                                                ^^^
lib/tasks/data.rake:19:9: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
    ids["objectIds"].each_slice(150).each do |chunk|
        ^^^^^^^^^^^
lib/tasks/data.rake:24:12: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
      data["features"].each do |d|
           ^^^^^^^^^^
lib/tasks/data.rake:25:42: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
        next if TYPES_TO_SKIP.include? d["attributes"]["TYPE"]
                                         ^^^^^^^^^^^^
lib/tasks/data.rake:25:56: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
        next if TYPES_TO_SKIP.include? d["attributes"]["TYPE"]
                                                       ^^^^^^
lib/tasks/data.rake:26:31: C: Prefer single-quoted strings inside interpolations.
        output_csv.write("#{d["geometry"]["x"]},#{d["geometry"]["y"]},#{d["attributes"]["OWNER"]},#{d["attributes"]["OPERATIONALAREA"]},#{d["attributes"]["TYPE"]},#{d["attributes"]["FORM"]}\n")
                              ^^^^^^^^^^
lib/tasks/data.rake:26:43: C: Prefer single-quoted strings inside interpolations.
        output_csv.write("#{d["geometry"]["x"]},#{d["geometry"]["y"]},#{d["attributes"]["OWNER"]},#{d["attributes"]["OPERATIONALAREA"]},#{d["attributes"]["TYPE"]},#{d["attributes"]["FORM"]}\n")
                                          ^^^
lib/tasks/data.rake:26:53: C: Prefer single-quoted strings inside interpolations.
        output_csv.write("#{d["geometry"]["x"]},#{d["geometry"]["y"]},#{d["attributes"]["OWNER"]},#{d["attributes"]["OPERATIONALAREA"]},#{d["attributes"]["TYPE"]},#{d["attributes"]["FORM"]}\n")
                                                    ^^^^^^^^^^
lib/tasks/data.rake:26:65: C: Prefer single-quoted strings inside interpolations.
        output_csv.write("#{d["geometry"]["x"]},#{d["geometry"]["y"]},#{d["attributes"]["OWNER"]},#{d["attributes"]["OPERATIONALAREA"]},#{d["attributes"]["TYPE"]},#{d["attributes"]["FORM"]}\n")
                                                                ^^^
lib/tasks/data.rake:26:75: C: Prefer single-quoted strings inside interpolations.
        output_csv.write("#{d["geometry"]["x"]},#{d["geometry"]["y"]},#{d["attributes"]["OWNER"]},#{d["attributes"]["OPERATIONALAREA"]},#{d["attributes"]["TYPE"]},#{d["attributes"]["FORM"]}\n")
                                                                          ^^^^^^^^^^^^
lib/tasks/data.rake:26:89: C: Prefer single-quoted strings inside interpolations.
        output_csv.write("#{d["geometry"]["x"]},#{d["geometry"]["y"]},#{d["attributes"]["OWNER"]},#{d["attributes"]["OPERATIONALAREA"]},#{d["attributes"]["TYPE"]},#{d["attributes"]["FORM"]}\n")
                                                                                        ^^^^^^^
lib/tasks/data.rake:26:103: C: Prefer single-quoted strings inside interpolations.
        output_csv.write("#{d["geometry"]["x"]},#{d["geometry"]["y"]},#{d["attributes"]["OWNER"]},#{d["attributes"]["OPERATIONALAREA"]},#{d["attributes"]["TYPE"]},#{d["attributes"]["FORM"]}\n")
                                                                                                      ^^^^^^^^^^^^
lib/tasks/data.rake:26:117: C: Prefer single-quoted strings inside interpolations.
        output_csv.write("#{d["geometry"]["x"]},#{d["geometry"]["y"]},#{d["attributes"]["OWNER"]},#{d["attributes"]["OPERATIONALAREA"]},#{d["attributes"]["TYPE"]},#{d["attributes"]["FORM"]}\n")
                                                                                                                    ^^^^^^^^^^^^^^^^^
lib/tasks/data.rake:26:141: C: Prefer single-quoted strings inside interpolations.
        output_csv.write("#{d["geometry"]["x"]},#{d["geometry"]["y"]},#{d["attributes"]["OWNER"]},#{d["attributes"]["OPERATIONALAREA"]},#{d["attributes"]["TYPE"]},#{d["attributes"]["FORM"]}\n")
                                                                                                                                            ^^^^^^^^^^^^
lib/tasks/data.rake:26:155: C: Prefer single-quoted strings inside interpolations.
        output_csv.write("#{d["geometry"]["x"]},#{d["geometry"]["y"]},#{d["attributes"]["OWNER"]},#{d["attributes"]["OPERATIONALAREA"]},#{d["attributes"]["TYPE"]},#{d["attributes"]["FORM"]}\n")
                                                                                                                                                          ^^^^^^
lib/tasks/data.rake:26:168: C: Prefer single-quoted strings inside interpolations.
        output_csv.write("#{d["geometry"]["x"]},#{d["geometry"]["y"]},#{d["attributes"]["OWNER"]},#{d["attributes"]["OPERATIONALAREA"]},#{d["attributes"]["TYPE"]},#{d["attributes"]["FORM"]}\n")
                                                                                                                                                                       ^^^^^^^^^^^^
lib/tasks/data.rake:26:182: C: Prefer single-quoted strings inside interpolations.
        output_csv.write("#{d["geometry"]["x"]},#{d["geometry"]["y"]},#{d["attributes"]["OWNER"]},#{d["attributes"]["OPERATIONALAREA"]},#{d["attributes"]["TYPE"]},#{d["attributes"]["FORM"]}\n")
                                                                                                                                                                                     ^^^^^^
lib/tasks/data.rake:47:7: W: Useless assignment to variable - thing. Did you mean thing_hash?
      thing = Thing.create(thing_hash)
      ^^^^^

71 files inspected, 24 offenses detected

I'd like to open this thread as a step towards resolving the differences between rubocop's stylistic preferences and our source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant