defra_ruby_style 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/default.yml +107 -0
- data/lib/defra/style/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c6dd1fde6b73075da53caf161fde3e56508926e
|
4
|
+
data.tar.gz: a3b19d22fe67b54f50f3f425e6cfea3baf5692b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fecbab42bca3a7a25495575a09ce70a4fa9ace8f796880d810a1d6c8583007abdd5799458f2b4de33d888931720751f59abfc379f943da4f51c922743ecee768
|
7
|
+
data.tar.gz: 1251fb973723f7e0afca8407b3d2e204f71fc11347914c87706b489196a6bd63f14574fedd9d29b8393e3e45189c77733c1dab18465702ca65140ad36539ebbc
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
<img src="/defra-ruby-style.png" alt="Defra ruby style logo" />
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.com/DEFRA/defra-ruby-style.svg?branch=master)](https://travis-ci.com/DEFRA/defra-ruby-style)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/defra_ruby_style.svg)](https://badge.fury.io/rb/defra_ruby_style)
|
5
|
+
[![Licence](https://img.shields.io/badge/Licence-OGLv3-blue.svg)](http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3)
|
4
6
|
|
5
7
|
This repository is used to manage the ruby code style we use at DEFRA.
|
6
8
|
|
data/default.yml
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.4
|
3
|
+
# Cop names are not displayed in offense messages by default. We find it
|
4
|
+
# useful to include this information so we can use it to investigate what the
|
5
|
+
# fix may be.
|
6
|
+
DisplayCopNames: true
|
7
|
+
# Style guide URLs are not displayed in offense messages by default. Again we
|
8
|
+
# find it useful to go straight to the documentation for a rule when
|
9
|
+
# investigating what the fix may be.
|
10
|
+
DisplayStyleGuide: true
|
11
|
+
Include:
|
12
|
+
- "**/*.gemspec"
|
13
|
+
- "**/*.rake"
|
14
|
+
- "**/*.thor"
|
15
|
+
- "**/*.rb"
|
16
|
+
- "**/*.ru"
|
17
|
+
- "**/Gemfile"
|
18
|
+
- "**/Rakefile"
|
19
|
+
Exclude:
|
20
|
+
# config contains standard files created when Rails is initialised and
|
21
|
+
# therefore they should be left as is
|
22
|
+
- "config/**/*"
|
23
|
+
# bin contains standard files created when Rails is initialised and
|
24
|
+
# therefore they should be left as is
|
25
|
+
- "bin/**/*"
|
26
|
+
# locally when we run rubocop it ignores the vendor folder but when running
|
27
|
+
# in Travis-CI it seems to include. This will stop this from happening
|
28
|
+
- "vendor/**/*"
|
29
|
+
## schema.rb is generated automatically based on migrations, so leave as is
|
30
|
+
- "**/db/schema.rb"
|
31
|
+
- "db/migrate*/**/*.rb"
|
32
|
+
# Skip dummy application files as they're only used for testing purposes
|
33
|
+
- "spec/dummy/**/*"
|
34
|
+
|
35
|
+
# It is our opinion that code is easier to read if a white space is
|
36
|
+
# permitted between the initial declaration and the first statement. Ditto the
|
37
|
+
# last statement and the closing tag.
|
38
|
+
Layout/EmptyLinesAroundModuleBody:
|
39
|
+
Enabled: false
|
40
|
+
Layout/EmptyLinesAroundClassBody:
|
41
|
+
Enabled: false
|
42
|
+
Layout/EmptyLinesAroundBlockBody:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
# It's okay to use `catch { foo }` in specs
|
46
|
+
#
|
47
|
+
# https://github.com/rubocop-hq/rubocop/issues/4222
|
48
|
+
Lint/AmbiguousBlockAssociation:
|
49
|
+
Exclude:
|
50
|
+
- "spec/**/*_spec.rb"
|
51
|
+
|
52
|
+
# We felt as a team that the default size of 15 was too low, and blocked what to
|
53
|
+
# us are sound methods which would not add any value if broken up, for example
|
54
|
+
# composer type methods. Therefore we agreed to up the score to 30 to allow for
|
55
|
+
# these types of methods
|
56
|
+
Metrics/AbcSize:
|
57
|
+
Max: 30
|
58
|
+
|
59
|
+
# We don't feel it makes sense to split specs and factories over multiple files,
|
60
|
+
# or when in a context be forced to try and come up with slightly different ones
|
61
|
+
# in order to reduce the block length. Hence we exclude specs and factories from
|
62
|
+
# this rule.
|
63
|
+
# Shared examples are the same as specs, but don't have the _spec.rb extension
|
64
|
+
# hence they are listed separately
|
65
|
+
Metrics/BlockLength:
|
66
|
+
Exclude:
|
67
|
+
# We're not bothered about a gemspec file having long block length
|
68
|
+
- "**/*.gemspec"
|
69
|
+
- "spec/**/*_spec.rb"
|
70
|
+
- "spec/shared_examples/**/*.rb"
|
71
|
+
- "spec/factories/**/*.rb"
|
72
|
+
- "spec/support/shared_examples/**/*.rb"
|
73
|
+
|
74
|
+
# We believe the default 80 characters is too restrictive and that lines can
|
75
|
+
# still be readable and maintainable when no more than 120 characters. This also
|
76
|
+
# allows us to maximise our screen space.
|
77
|
+
Metrics/LineLength:
|
78
|
+
Max: 120
|
79
|
+
Exclude:
|
80
|
+
- "spec/**/*_spec.rb"
|
81
|
+
- "spec/factories/**/*.rb"
|
82
|
+
- "spec/support/shared_examples/**/*.rb"
|
83
|
+
|
84
|
+
# We wish we were good enough to remain within the rubocop limit of 10 lines
|
85
|
+
# however we often just seem to tip over by a few lines. Hence we have chosen
|
86
|
+
# to bump it to 20.
|
87
|
+
Metrics/MethodLength:
|
88
|
+
Max: 20
|
89
|
+
|
90
|
+
# Spec files can be quite long, so we shouldn't be forced to break them up
|
91
|
+
# if it doesn't make sense.
|
92
|
+
Metrics/ModuleLength:
|
93
|
+
Exclude:
|
94
|
+
- "spec/**/*_spec.rb"
|
95
|
+
- "spec/factories/**/*.rb"
|
96
|
+
- "spec/support/shared_examples/**/*.rb"
|
97
|
+
|
98
|
+
# As a web app, as long as the team commit to using well named classes for
|
99
|
+
# controllers, models etc it should not be necessary to add top-level class
|
100
|
+
# documentation.
|
101
|
+
Style/Documentation:
|
102
|
+
Enabled: false
|
103
|
+
|
104
|
+
# There are no relative performance improvements using '' over "", therefore we believe there is more
|
105
|
+
# value in using "" for all strings irrespective of whether string interpolation is used
|
106
|
+
Style/StringLiterals:
|
107
|
+
EnforcedStyle: double_quotes
|
data/lib/defra/style/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: defra_ruby_style
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Defra
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- LICENSE
|
64
64
|
- README.md
|
65
65
|
- Rakefile
|
66
|
+
- default.yml
|
66
67
|
- lib/defra/style.rb
|
67
68
|
- lib/defra/style/version.rb
|
68
69
|
homepage: https://github.com/DEFRA/defra-ruby-style
|