반응형
RuboCop : 줄이 너무 깁니다. <— 무시하는 방법
방금 RuboCop을 rails 프로젝트에 추가하고 Sublime 패키지를 설치하여 편집기에서 RuboCop 제안을 확인했습니다. 최대 줄 길이를 80 자에서 변경하는 방법을 알아 내거나 규칙을 완전히 무시하는 중입니다.
현재 사용 중 :
코드에서 다음과 같이 여러 줄을 비활성화 할 수 있습니다.
# rubocop:disable LineLength
puts "This line is lonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnng"
# rubocop:enable LineLength
또는 다음을 .rubocop.yml
파일에 추가하여 최대 길이를 늘리십시오.
Metrics/LineLength:
Max: 100
프로젝트의 루트에 .rubocop.yml
파일을 만들면 (파일 .
이름 의 이니셜 을 확인하십시오) 다음과 같은 여러 옵션이 있습니다.
Metrics/LineLength:
# This will disable the rule completely, regardless what other options you put
Enabled: false
# Change the default 80 chars limit value
Max: 120
# If you want the rule only apply to a specific folder/file
Include:
- 'app/**/*'
# If you want the rule not to apply to a specific folder/file
Exclude:
- 'db/schema.rb'
참고 URL : https://stackoverflow.com/questions/37228624/rubocop-line-is-too-long-how-to-ignore
반응형
'developer tip' 카테고리의 다른 글
엔티티 프레임 워크 지정된 메타 데이터 리소스를로드 할 수 없습니다. (0) | 2020.10.26 |
---|---|
yaml에서 연관 배열 목록을 만드는 방법 (0) | 2020.10.26 |
C ++ 네임 스페이스 조언 (0) | 2020.10.26 |
PHP 경고 : 호출 시간 참조에 의한 전달이 더 이상 사용되지 않습니다. (0) | 2020.10.26 |
moment.js isValid 함수가 제대로 작동하지 않습니다. (0) | 2020.10.26 |