Skip to content

Unable to format with Rubocop #3

@anlek

Description

@anlek

When I use the keyboard shortcut, I get the following error in my console:

Unable to open /Users/andrew/Library/Application Support/Sublime Text 3/Packages/Codefmt/Codefmt.sublime-settings
git: tracking working dir /Users/andrew/Library/Application Support/Sublime Text 3/Packages/User
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python38/sublime_plugin.py", line 1518, in run_
    return self.run(edit)
  File "/Users/andrew/Library/Application Support/Sublime Text 3/Installed Packages/Codefmt.sublime-package/FormatCodeFile.py", line 7, in run
  File "/Users/andrew/Library/Application Support/Sublime Text 3/Installed Packages/Codefmt.sublime-package/utils.py", line 37, in format_code_file
  File "/Users/andrew/Library/Application Support/Sublime Text 3/Installed Packages/Codefmt.sublime-package/utils.py", line 122, in find_matching_formatters
TypeError: 'NoneType' object is not iterable

My config looks like this:

{
  "format_on_save": true,
  "debug": true,
  "rubocop": {
    // The command that will be executed for format files.
    "command": [
      "/Users/andrew/.asdf/shims/rubocop",
      "--auto-correct-all",
      "--config",
      "$config",
      "$file"
    ],

    // The scopes that will be considered when formatting
    "scopes": ["source.ruby", "source.ruby.rails"],

    // Additional flags when running in debug mode.
    "debug": ["--debug", "--extra-details"],

    // When no custom config file exists, use a default config file.
    "default_config": null,

    // Config files that will be looked up on the root of the project.
    "config_files": [".rubocop.yml"]
  },
  "formatters": [
    "rubocop",
  ]
}

However, I've tried running the code with my settings looking like: {}

I believe this issue is actually that it can't find the /Users/andrew/Library/Application Support/Sublime Text 3/Packages/Codefmt/Codefmt.sublime-settings. As the Codefmt is not there for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions