0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Visual Studio Code設定めも

Last updated at Posted at 2020-04-25

はじめに

後で記載内容をきれいに整理しないとな...

操作ネタ

矩形選択

■マウス:始点をクリックしてから、終点を[Shift]+[Alt]+左クリック(したままドラッグ)
■キーボード:[Ctrl]+[Shift]+[Alt]+矢印キー

設定値めも(For ポータブル)

data\argv.json
	// VSCode日本語化
	"locale": "ja",
data\user-data\User\settings.json
    // ユーザー別の格納場所
    //   %USERPROFILE%\AppData\Roaming\Code\User\settings.json

    // VS Codeのウィンドウサイズ制御
    "window.newWindowDimensions": "inherit",
extensions_setting.ps1
# usage 
#  PowerShell -ExecutionPolicy RemoteSigned .\extensions_setting.ps1 %USERPROFILE%

Param($Args1)
if([string]::IsNullorEmpty($Args1)) {
    Write-Host "1個目の引数(ユーザー名)が指定されていません"
    Write-Host "usage"
    Write-Host " .\extensions_setting.ps1 %USERPROFILE%"
    return
}

# 拡張機能の設定ファイルパスを変更
(Get-Content extensions.json) | ForEach-Object { $_ -replace 'c:\\\\Users\\\\wakas',"$Args1".Replace('\','\\') } | Set-Content extensions.json
(Get-Content extensions.json) | ForEach-Object { $_ -replace "c:/Users/wakas","$Args1".Replace('\','/') } | Set-Content extensions.json

# 置換前のユーザー名情報を削除(__pycache__配下のファイル以外もある場合は個別で削除処理を追加すること!!)
Get-ChildItem ./__pycache__ -Recurse | Remove-Item -Recurse -Force

考え方は下記サイトから...Thanks!!
◆vscodeのsettings.jsonを晒してみる(v1.25.1)
 https://qiita.com/k3nNy_51rcy/items/5e9adc0401650233acff
◆JSONにコメントを記述する方法の備忘録
 https://www.nxworld.net/tips/use-comment-in-json.html

◆VS Codeでエンコーディングを変更、自動判別するには:Visual Studio Code TIPS - @IT
 https://atmarkit.itmedia.co.jp/ait/articles/1806/01/news051.html
  ※変更方法がいくつか書かれている!!

拡張機能

全般

  • jebbs.plantuml-2.13.8
  • ms-ceintl.vscode-language-pack-ja-1.44.2

PowerShell関連

  • ms-python.python-2020.4.74986
  • ms-vscode.powershell-2020.4.0

Angular関連

  • eg2.tslint-1.0.44

参考サイト

◆VisualStudioCode(VSCode)の設定引き継ぎ
 https://pg.4696.info/other/vscode-setting.html
 
◆Visual Studio Codeで日本語化する方法[Windows]
 https://qiita.com/nanamesincos/items/5c48ff88a4eeef0a8631

◆Visual Studio Code で「保存時に自動整形」「タイプ時に自動整形」を有効にする
 https://devadjust.exblog.jp/23791887/

◆VSCode に必ず入れておきたい拡張機能
 https://qiita.com/ucan-lab/items/e85931bf8276da43cc97

 

Python関連

flake8

ID Message 意訳 対策
W291 Trailing whitespace 行末に空白が存在する 空白を削除
W293 Blank line contains whitespace 空白行に空白またはタブが存在する 空白またはタブを削除
W391 Blank line at end of file ファイルの末尾に複数の空白行が存在する 空白を削除
W503 Line break occurred before a binary operator 二項演算子の前に改行が存在する 改行しない(★or 問題あれば抑止)
W504 Line break occurred after a binary operator 二項演算子の後に改行が存在する 改行しない(★or 問題あれば抑止)
E203 Whitespace before ':' コロンの前に空白が入っている 空白を削除
E225 Missing whitespace around operator 演算子の前後に空白が存在しない 空白を追加
E226 Missing whitespace around arithmetic operator 算術演算子(+, -, /, *)の前後に空白が存在しない 空白を追加
E231 Missing whitespace after ',', ';', or ':' ',', ';', ':'の前後に空白が存在しない 空白を追加
E251 Unexpected spaces around keyword / parameter equals 関数定義時の = 前後に空白が存在する 空白を削除
E261 At least two spaces before inline comment インラインコメントの前には少なくとも2つのスペースが必要である 空白を追加
E265 Block comment should start with '# ' ブロックコメントは'# 'で始める必要がある 空白を追加
E266 Too many leading '#' for block comment ブロックコメントを開始する # が多すぎる #を削除(★or 問題あれば抑止)
E275 Missing whitespace after keyword キーワードの後に空白が存在しない 空白を追加
E302 Expected 2 blank lines, found 0 関数とクラスの間に2行の空白行が必要 空白を追加(★or 問題あれば抑止)
E501 Line to long ((length) > 79 characters) 一行の文字数が多すぎる(推奨最大文字数は79文字) ★抑止(or 問題あれば79行になるようにコード修正)
E711 Comparison to none should be 'if cond is none:' True, False, Noneといったシングルトンオブジェクトを同一性ではなく等価性で比較している コード修正(is, is not)
E712 Comparison to true should be 'if cond is true:' or 'if cond:' True との比較を等価演算子を用いて行っている コード修正('is True' or 変数のみ )
F401 Module imported but unused インポートしたモジュールが使われていない import行を削除
F403 'from module import *' used; unable to detect undefined names 利用しているモジュールが見つけられない *⇒利用モジュールに変更(★or 問題あれば抑止)
F405 Name may be undefined, or defined from star imports: module *でモジュールをインポートしているので出力時に判断できない *⇒利用モジュールに変更(★or 問題あれば抑止)
F541 f-string without any placeholders 変数利用のないf文字列が使われている f削除
F811 Redefinition of unused name from line n インポート定義が重複している 重複しているインポート定義削除
F841 Local variable name is assigned to but never used ローカル変数が使われていない 対象行削除(★or 問題あれば抑止)

参考サイト

◆pycodestyle(pep8) エラーコードチートシート
 https://qiita.com/KuruwiC/items/8e12704e338e532eb34a
◆【PEP8&flake8】pythonにおけるPEP8とflake8
 https://megatenpa.com/python/base/pep8-flake8/
◆Pythonのコードチェッカ(flake8)エラーコード一覧と自動フォーマッター(autopep8)
 https://arakan-pgm-ai.hatenablog.com/entry/2018/11/12/090000
  ※autopep8で下記があるとは知らなかった...
   「 --aggressive」は二つ指定すると、レベル2になって、修正対象のエラーが増えるので、自分にはちょうど良いです。
◆The Big Ol' List of Rules
 https://lintlyci.github.io/Flake8Rules/
  ※ここが公式サイトの模様
◆【Python】flake8指摘事項まとめ
 https://www.yokoyan.net/entry/2018/07/02/181500
◆flake8の使い方とオプション
 https://qiita.com/raku_taro/items/93dacae018fb192d05b5
  ※参考となるコマンドオプションが記載されている
◆Python で pep-8 の「E501 line too long」にしないためのコーディングテクニック
 http://www.sakito.com/2012/09/python-pep-8-e501-line-too-long.html
◆Flake8で注意を無視する色々な方法 | hgrs's Blog
 https://blog.hgrs.me/20190521153613
◆コードの修正がめんどくさいなら、autopep8で自動修正
 https://yoshitaku-jp.hatenablog.com/entry/2018/09/15/135813
◆Introduction — pycodestyle 2.10.0 documentation
 https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
  ※autopep8のエラーコード一覧はここで
◆【Python3】Lintツールflake8の W503 と W504 どっちが正しいのか、それとも両方正しいのか
 https://teratail.com/questions/213385
  ※W503を推奨ということでこちらを無効化ということで
◆ファイル単位でflake8の警告を制御する
 https://qiita.com/yoichi22/items/394a18826423ea8cebcf
◆Pythonの相対インポートで上位ディレクトリ・サブディレクトリを指定
 https://note.nkmk.me/python-relative-import/
  ※importモジュールの検索ネタはこちらで確認できる
◆VS Code コーディング規約を快適に守る
 https://qiita.com/firedfly/items/00c34018581c6cec9b84
◆Flake8で注意を無視する色々な方法 | hgrs's Blog
 https://blog.hgrs.me/20190521153613
◆VisualStudioCode(VSCode)の設定引き継ぎ
 https://pg.4696.info/other/vscode-setting.html
◆VS Codeでテキストの折り返しを設定するには
 https://atmarkit.itmedia.co.jp/ait/articles/1807/27/news035.html

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?