You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.md
+38-7Lines changed: 38 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -15,13 +15,13 @@ If you encounter problems or have ideas for improvements or new features, please
15
15
## Pull requests
16
16
17
17
1. Fork the project.
18
-
2. Create a feature branch.
19
-
3. Make sure to add tests.
20
-
4. Make sure the test suite passes (run `rake`).
21
-
5. Add a [changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md) entry.
22
-
6. Commit your changes.
23
-
7. Push to the branch.
24
-
8. Create new Pull Request.
18
+
1. Create a feature branch.
19
+
1. Make sure to add tests.
20
+
1. Make sure the test suite passes (run `rake`).
21
+
1. Add a [changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md) entry.
22
+
1. Commit your changes.
23
+
1. Push to the branch.
24
+
1. Create new Pull Request.
25
25
26
26
### Spell Checking
27
27
@@ -51,6 +51,37 @@ We are running [mdformat](https://github.com/executablebooks/mdformat) for forma
51
51
$ mdformat . --number
52
52
```
53
53
54
+
### Test Coverage - Line and Branch
55
+
56
+
We are using [Simplecov](https://github.com/colszowka/simplecov) to track test coverage.
57
+
58
+
It is included and reported when you run `bundle exec rake` or `bundle exec rspec`.
59
+
60
+
To view the coverage report, open the `coverage/index.html` file in your browser.
61
+
62
+
E.g. on macOS:
63
+
64
+
```console
65
+
$ open coverage/index.html
66
+
```
67
+
68
+
If you have unreachable lines, you can add `# :nocov` around those lines. The code itself or a comment should explain why the line is unreachable.
69
+
70
+
Example:
71
+
72
+
```ruby
73
+
# :nocov:
74
+
raiseArgumentError("Unsupported style :#{style}")
75
+
# :nocov:
76
+
```
77
+
78
+
This can happen for a few reasons, including:
79
+
80
+
1. When you handle config with a case statement and there is no else block
81
+
1. When matching with a node pattern even when you handle all cases: all other node types will be excluded before reaching your handler, because the node pattern will not match them.
82
+
83
+
You will need full line and branch coverage to merge. This helps detect edge cases and prevent errors.
84
+
54
85
## Creating new cops
55
86
56
87
- Document examples of good and bad code in your cop.
0 commit comments