質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Q&A

0回答

3833閲覧

すごく謎です。。VScodeでRubocopが急に動かなくなり、format時にエラーがでます。

mika2002

総合スコア20

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

0グッド

1クリップ

投稿2020/06/20 05:07

編集2020/06/21 06:14

VScodeにRubocopで保存時にフォーマットする設定をしていたのですが、急に動かなくなり、

Warning: no department given for LineLength. Configuration file not found: ~~~/.rubocop_airbnb.yml

An error occured during autocorrection

というエラーがVScodeの右下に表示されます。

エラーの指摘のとおりに、.rubocop_airbnb.yml、.rubocop.ymlを確認し、yamlチェッカー等で内容に問題がないかも確認したのですが、原因がわかりませんでした。

以下が関連のファイルになるのですが、
どなたかアドバイス頂けると幸いです。。

.rubocop.yml

ruby

1inherit_from: 2 - .rubocop_airbnb.yml 3 4# Rails用に最適化 5Rails: 6 Enabled: true 7 8# 文字数の上限を80文字から変更 9LineLength: 10 Max: 130 11 12#rubocopで検証したくないフォルダを指定 13AllCops: 14 Exclude: 15 - 'db/**/*' 16 - 'bin/*' 17 - 'config/environments/*' 18 - 'config/application.rb' 19 - 'config/initializers/*' 20 - 'config/spring.rb' 21 - 'lib/tasks/*' 22 - 'vendor/**/*' 23 - 'path/ruby' 24 25Style/Documentation: 26 Enabled: false 27 28 29Metrics/BlockLength: 30 Enabled: false 31 Exclude: 32 - '*' 33 Max: 200 34 35Metrics/MethodLength: 36 Enabled: false 37 CountComments: false # count full line comments? 38 Max: 200 39 40Metrics/LineLength: 41 Enabled: true 42 CountComments: false # count full line comments? 43 Max: 500 44 45Style/ClassAndModuleChildren: 46 Enabled: false 47 48 49

.rubocop-airbnb.yml

ruby

1require: 2 - rubocop-airbnb 3

Support/Code/User/settings.json

json

1{ 2 "editor.suggestSelection": "first", 3 "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue", 4 "diffEditor.renderSideBySide": false, // Git の差分を行内に表示 5 "editor.colorDecorators": false, // 入力した行を自動でフォーマット 6 "editor.minimap.renderCharacters": false, // ミニマップの表示文字をブロックに変更 7 "editor.minimap.showSlider": "always", // 表示領域をミニマップで常にハイライト 8 "editor.multiCursorModifier": "ctrlCmd", // マウスでの複数選択時の修飾キーを変更 9 "editor.renderControlCharacters": true, // 制御文字を表示 10 "editor.renderLineHighlight": "all", // 選択行を行番号含めすべてハイライト 11 "editor.renderWhitespace": "all", // 半角スペースを常に表示 12 "editor.snippetSuggestions": "top", // Emmet などのスニペット候補を優先して表示 13 "editor.tabSize": 2, // タブのサイズ変更 14 "editor.wordWrap": "on", // エディターの幅で折り返し 15 "terminal.integrated.copyOnSelection": true, 16 "emmet.showSuggestionsAsSnippets": true, // TAB キーで Emmet を展開できるようにする 17 "emmet.variables": { 18 // Emmet で展開される HTML の言語を変更 19 "lang": "ja" 20 }, 21 "emmet.includeLanguages": { 22 "erb": "html", 23 "javascript": "javascriptreact" 24 }, 25 "explorer.confirmDelete": false, // ファイル削除時の確認を表示しない 26 "files.associations": { 27 // ファイルと言語の関連付けを変更 28 // "*.html.erb": "html", 29 ".*lintrc": "json", 30 "*.erb": "erb" 31 }, 32 "files.exclude": { 33 "**/.git": false, 34 "**/*.map": true 35 // "**/node_modules": true 36 }, 37 "files.insertFinalNewline": true, // ファイルの保存時に末尾を改行 38 "files.trimFinalNewlines": false, // ファイルの保存時に最終行以降をトリミング 39 "files.trimTrailingWhitespace": false, // ファイルの保存時に行末の空白をトリミング 40 "[markdown]": { 41 "files.trimTrailingWhitespace": false // Markdown のファイルは行末の空白をトリミングしない 42 }, 43 // コンテンツを再フォーマットしてはならないタグをコンマで区切ってリストにします。'null' は、既定値の'pre' タグを表します。 44 "html.format.contentUnformatted": "pre,code,textarea", 45 // 末尾に改行を入れます。 46 // 直前に改行を1つ入れるタグの、コンマで区切られたリストです。'null'は、既定値の"head, body, /html" を表します。 47 "html.format.extraLiners": "head, body, /html", 48 // 書式設定とインデント{{#foo}}および{{/foo}}。 49 "html.format.indentHandlebars": false, 50 // 1つのチャンク内に保持できる改行の最大数。無制限にするには、'null'を使います。 51 "html.format.maxPreserveNewLines": null, 52 // 要素の前にある既存の改行を保持するかどうか。要素の前でのみ機能し、タグの内側やテキストに対しては機能しません。 53 "html.format.preserveNewLines": true, 54 // 再フォーマットしてはならないタグの、コンマ区切りの一覧。'null'の場合、既定で https://www.w3.org/TR/html5/dom.html#phrasing-content にリストされているすべてのタグになります。 55 // 属性を折り返します。 56 "html.format.wrapAttributes": "auto", 57 // 1行あたりの最大文字数 (0=無効にする)。 58 "html.format.unformatted": null, // フレージング・コンテンツ(旧インライン要素のようなタグ)はフォーマットしない 59 "html.format.wrapLineLength": 3000, // 行の文字数制限を無くし自動で改行させない 60 "search.exclude": { 61 // 検索対象外にするファイル設定( files.exclude のファイルも含む) 62 "**/tmp": true 63 }, 64 "window.openFoldersInNewWindow": "on", // 新規ワークスペースを別ウインドウで開く 65 "window.title": "${activeEditorMedium}${separator}${rootName}", // ウインドウ上部に表示する文字列の設定 66 "workbench.editor.labelFormat": "short", // タブに表示する文字列の設定 67 "workbench.editor.tabSizing": "shrink", // タブの表示設定 68 "workbench.editor.enablePreview": false, 69 "workbench.editor.enablePreviewFromQuickOpen": false, 70 "workbench.startupEditor": "none", 71 "window.zoomLevel": 1, 72 "editor.minimap.enabled": false, 73 "workbench.tree.indent": 7, 74 "explorer.autoReveal": false, 75 "workbench.list.openMode": "doubleClick", 76 "files.hotExit": "off", 77 "auto-close-tag.fullMode": true, 78 "emmet.triggerExpansionOnTab": true, 79 "html.suggest.html5": false, // Welcome Page を表示しない 80 // "cSpell.enableFiletypes": "erb", 81 "cSpell.ignoreRegExpList": ["[0-9A-Za-zぁ-んァ-ヶ亜-熙纊-黑]+"], 82 // "cSpell": { 83 "cSpell.enabledLanguageIds": [ 84 "css", 85 "html", 86 "javascript", 87 "json", 88 "less", 89 "markdown", 90 "plaintext", 91 "scss", 92 "text", 93 "ruby", 94 "yaml", 95 "yml" 96 ], 97 98 // "eslint.autoFixOnSave": true, 99 "[ruby]": { 100 "editor.formatOnSave": true, 101 "editor.defaultFormatter": "misogi.ruby-rubocop" 102 // "editor.defaultFormatter": "mbessey.vscode-rufo" 103 }, 104 105 "editor.formatOnSaveTimeout": 5000, 106 "ruby.useLanguageServer": true, 107 "ruby.lint": { 108 "rubocop": true 109 }, 110 "ruby.format": "rubocop", 111 "workbench.iconTheme": "material-icon-theme", 112 "[html]": { 113 // "editor.defaultFormatter": "aliariff.vscode-erb-beautify", 114 // "editor.defaultFormatter": "HookyQR.beautify", 115 116 "editor.formatOnSave": true, 117 "editor.defaultFormatter": "esbenp.prettier-vscode" 118 }, 119 "liveServer.settings.donotShowInfoMsg": true, 120 "liveServer.settings.CustomBrowser": "chrome", 121 "liveServer.settings.donotVerifyTags": true, 122 "diffEditor.ignoreTrimWhitespace": false "ruby.rubocop.executePath": "/Users/aa/.rbenv/shims/", 123 "ruby.rubocop.onSave": true, 124 "beautify.language": { 125 "js": { 126 "type": ["javascript", "json", "jsonc"], 127 "filename": [".jshintrc", ".jsbeautifyrc"] 128 }, 129 "css": ["css", "scss"], 130 "html": ["htm", "html", "blade", "html.erb", "erb"] 131 }, 132 "html.format.endWithNewline": true, 133 "[gemfile]": { 134 // "editor.defaultFormatter": "misogi.ruby-rubocop" 135 }, 136 "[scss]": { 137 // "editor.defaultFormatter": "HookyQR.beautify" 138 }, 139 "prettier.bracketSpacing": false, 140 "prettier.requirePragma": true, 141 "csscomb.formatOnSave": true, 142 "editor.formatOnSave": true, 143 "editor.formatOnType": true, 144 "editor.formatOnPaste": true, 145 // "editor.defaultFormatter": "misogi.ruby-rubocop", 146 "[erb]": { 147 // "editor.defaultFormatter": "misogi.ruby-rubocop", 148 // "editor.defaultFormatter": "HookyQR.beautify", 149 "editor.tabSize": 2 150 }, 151 152 "scrollkey.line1": 1, 153 "scrollkey.line2": 3, 154 "keyboard.dispatch": "keyCode", 155 "[javascript]": { 156 "editor.defaultFormatter": "esbenp.prettier-vscode" 157 }, 158 "[typescript]": { 159 "editor.defaultFormatter": "esbenp.prettier-vscode" 160 }, 161 "[typescriptreact]": { 162 "editor.defaultFormatter": "esbenp.prettier-vscode" 163 }, 164 "git.autofetch": true, 165 "editor.codeActionsOnSave": { 166 "source.fixAll": true 167 }, 168 "javascript.updateImportsOnFileMove.enabled": "always", 169 // "editor.codeActionsOnSave": { 170 // "source.fixAll.eslint": true 171 // } 172 "css.validate": false, // Disable css built-in lint 173 "stylelint.enable": true 174 175} 176

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問