readability-cli 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- configs/pyrefly.toml +11 -0
- configs/ruff.toml +20 -0
- guides/Rguide.md +109 -0
- guides/cppguide.md +5713 -0
- guides/csharp-style.md +478 -0
- guides/docguide-style.md +845 -0
- guides/go-guide.md +483 -0
- guides/htmlcssguide.md +1022 -0
- guides/javaguide.md +1189 -0
- guides/jsguide.md +3775 -0
- guides/jsoncstyleguide.md +1376 -0
- guides/objcguide.md +2386 -0
- guides/pyguide.md +3709 -0
- guides/shellguide.md +1343 -0
- guides/tsguide.md +3662 -0
- guides/vimscriptguide.md +356 -0
- readability.py +755 -0
- readability_cli-0.4.0.dist-info/METADATA +192 -0
- readability_cli-0.4.0.dist-info/RECORD +22 -0
- readability_cli-0.4.0.dist-info/WHEEL +4 -0
- readability_cli-0.4.0.dist-info/entry_points.txt +2 -0
- readability_cli-0.4.0.dist-info/licenses/LICENSE +21 -0
configs/pyrefly.toml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Default configuration used by `readability check` when the target project
|
|
2
|
+
# does not define its own pyrefly settings (pyrefly.toml or [tool.pyrefly] in
|
|
3
|
+
# pyproject.toml). The presence of a config file switches pyrefly from its
|
|
4
|
+
# lenient "basic" preset to full type checking.
|
|
5
|
+
|
|
6
|
+
[errors]
|
|
7
|
+
# When this bundled config is used, pyrefly treats its directory as the
|
|
8
|
+
# project root, so imports local to the checked project cannot be resolved
|
|
9
|
+
# reliably; suppress those errors to avoid false positives
|
|
10
|
+
missing-import = false
|
|
11
|
+
missing-module-attribute = false
|
configs/ruff.toml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Default configuration used by `readability check` when the target project
|
|
2
|
+
# does not define its own ruff settings (ruff.toml or [tool.ruff] in
|
|
3
|
+
# pyproject.toml). Based on the Google Python style guide:
|
|
4
|
+
# https://google.github.io/styleguide/pyguide.html
|
|
5
|
+
line-length = 80
|
|
6
|
+
|
|
7
|
+
[lint]
|
|
8
|
+
# Pycodestyle (E, W), Pyflakes (F), import order (I), naming (N),
|
|
9
|
+
# docstrings (D), and pylint (PL) rules
|
|
10
|
+
select = ["E", "W", "F", "I", "N", "D", "PL"]
|
|
11
|
+
# Complexity counters and magic-value warnings are guidance, not errors
|
|
12
|
+
ignore = ["PLR0911", "PLR0912", "PLR0913", "PLR0915", "PLR2004"]
|
|
13
|
+
|
|
14
|
+
[lint.pydocstyle]
|
|
15
|
+
convention = "google"
|
|
16
|
+
|
|
17
|
+
[lint.per-file-ignores]
|
|
18
|
+
# Docstring requirements are noise in test files
|
|
19
|
+
"test_*.py" = ["D"]
|
|
20
|
+
"*_test.py" = ["D"]
|
guides/Rguide.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Google's R Style Guide
|
|
2
|
+
|
|
3
|
+
R is a high-level programming language used primarily for statistical computing
|
|
4
|
+
and graphics. The goal of the R Programming Style Guide is to make our R code
|
|
5
|
+
easier to read, share, and verify.
|
|
6
|
+
|
|
7
|
+
The Google R Style Guide is a fork of the
|
|
8
|
+
[Tidyverse Style Guide](https://style.tidyverse.org/) by Hadley Wickham
|
|
9
|
+
[license](https://creativecommons.org/licenses/by-sa/2.0/). Google modifications
|
|
10
|
+
were developed in collaboration with the internal R user community. The rest of
|
|
11
|
+
this document explains Google's primary differences with the Tidyverse guide,
|
|
12
|
+
and why these differences exist.
|
|
13
|
+
|
|
14
|
+
## Syntax
|
|
15
|
+
|
|
16
|
+
### Naming conventions
|
|
17
|
+
|
|
18
|
+
Google prefers identifying functions with `BigCamelCase` to clearly distinguish
|
|
19
|
+
them from other objects.
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
# Good
|
|
23
|
+
DoNothing <- function() {
|
|
24
|
+
return(invisible(NULL))
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The names of private functions should begin with a dot. This helps communicate
|
|
29
|
+
both the origin of the function and its intended use.
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
# Good
|
|
33
|
+
.DoNothingPrivately <- function() {
|
|
34
|
+
return(invisible(NULL))
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
We previously recommended naming objects with `dot.case`. We're moving away from
|
|
39
|
+
that, as it creates confusion with S3 methods.
|
|
40
|
+
|
|
41
|
+
### Don't use attach()
|
|
42
|
+
|
|
43
|
+
The possibilities for creating errors when using `attach()` are numerous.
|
|
44
|
+
|
|
45
|
+
## Pipes
|
|
46
|
+
|
|
47
|
+
### Right-hand assignment
|
|
48
|
+
|
|
49
|
+
We do not support using right-hand assignment.
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
# Bad
|
|
53
|
+
iris %>%
|
|
54
|
+
dplyr::summarize(max_petal = max(Petal.Width)) -> results
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This convention differs substantially from practices in other languages and
|
|
58
|
+
makes it harder to see in code where an object is defined. E.g. searching for
|
|
59
|
+
`foo <-` is easier than searching for `foo <-` and `-> foo` (possibly split over
|
|
60
|
+
lines).
|
|
61
|
+
|
|
62
|
+
### Use explicit returns
|
|
63
|
+
|
|
64
|
+
Do not rely on R's implicit return feature. It is better to be clear about your
|
|
65
|
+
intent to `return()` an object.
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
# Good
|
|
69
|
+
AddValues <- function(x, y) {
|
|
70
|
+
return(x + y)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
# Bad
|
|
74
|
+
AddValues <- function(x, y) {
|
|
75
|
+
x + y
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Qualifying namespaces
|
|
80
|
+
|
|
81
|
+
Users should explicitly qualify namespaces for all external functions.
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
# Good
|
|
85
|
+
purrr::map()
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
We discourage using the `@import` Roxygen tag to bring in all functions into a
|
|
89
|
+
NAMESPACE. Google has a very big R codebase, and importing all functions creates
|
|
90
|
+
too much risk for name collisions.
|
|
91
|
+
|
|
92
|
+
While there is a small performance penalty for using `::`, it makes it easier to
|
|
93
|
+
understand dependencies in your code. There are some exceptions to this rule.
|
|
94
|
+
|
|
95
|
+
* Infix functions (`%name%`) always need to be imported.
|
|
96
|
+
* Certain `rlang` pronouns, notably `.data`, need to be imported.
|
|
97
|
+
* Functions from default R packages, including `datasets`, `utils`,
|
|
98
|
+
`grDevices`, `graphics`, `stats` and `methods`. If needed, you can `@import`
|
|
99
|
+
the full package.
|
|
100
|
+
|
|
101
|
+
When importing functions, place the `@importFrom` tag in the Roxygen header
|
|
102
|
+
above the function where the external dependency is used.
|
|
103
|
+
|
|
104
|
+
## Documentation
|
|
105
|
+
|
|
106
|
+
### Package-level documentation
|
|
107
|
+
|
|
108
|
+
All packages should have a package documentation file, in a
|
|
109
|
+
`packagename-package.R` file.
|