Title: | Check Code Style Painlessly |
---|---|
Description: | Infer the code style (which style rules are followed and which ones are not) from one package and use it to check another. This makes it easier to find and correct the most important problems first. |
Authors: | Max Conway [aut, cre], Natasha Latysheva [aut] |
Maintainer: | Max Conway <[email protected]> |
License: | GPL-3 |
Version: | 0.2.4 |
Built: | 2025-02-02 03:41:19 UTC |
Source: | https://github.com/maxconway/adaptalint |
Returns the absolute and relative counts of all lint errors found in the
package.
The resulting style data can be applied to another file with
lint_with_style
.
extract_package_style(package)
extract_package_style(package)
package |
path to the package of interest |
a data_frame with columns lint
, count
, total_lints
and adjusted
Returns the absolute and relative counts of all lint errors found in the
file.
The resulting style data can be applied to another file with
lint_with_style
or lint_package_with_style
.
extract_style(filename)
extract_style(filename)
filename |
path to the file of interest |
a data_frame with columns lint
, count
, total_lints
and adjusted
# Get the path to a file to check path <- system.file("extdata", 'styles.R', package='adaptalint') # Find out the profile of lints in this package style <- extract_style(filename = path)
# Get the path to a file to check path <- system.file("extdata", 'styles.R', package='adaptalint') # Find out the profile of lints in this package style <- extract_style(filename = path)
Apply a style extracted using extract_style
, in order to
check for only the style issues that aren't excepted in that package.
lint_package_with_style(package, style, threshold = 0.01)
lint_package_with_style(package, style, threshold = 0.01)
package |
path to the package to check |
style |
a style data frame, as created by |
threshold |
the proportional occurrence threshold above which a lint is ignored |
Apply a style extracted using extract_style
: lint a file,
checking only for errors that appear to be prohibited in that style.
lint_with_style(filename, style, threshold = 0.01)
lint_with_style(filename, style, threshold = 0.01)
filename |
path to the file to check |
style |
a style data frame, as created by |
threshold |
the proportional occurrence threshold above which a lint is ignored |
# Get a copy of the profile of lints from the purrr package data("style_purrr") # Get the path to a file to check path <- system.file("extdata", 'styles.R', package='adaptalint') # Check this file against the lint profile of purrr lint_with_style(filename = path, style = style_purrr)
# Get a copy of the profile of lints from the purrr package data("style_purrr") # Get the path to a file to check path <- system.file("extdata", 'styles.R', package='adaptalint') # Check this file against the lint profile of purrr lint_with_style(filename = path, style = style_purrr)
A style extracted from a popular package, included for convenience
style_adaptalint
style_adaptalint
An object of class tbl_df
(inherits from tbl
, data.frame
) with 2 rows and 4 columns.
Other bundled_styles: style_dplyr
,
style_fbar
, style_gsheet
,
style_plyr
, style_purrr
,
style_tidyr
A style extracted from a popular package, included for convenience
style_dplyr
style_dplyr
An object of class tbl_df
(inherits from tbl
, data.frame
) with 14 rows and 4 columns.
Other bundled_styles: style_adaptalint
,
style_fbar
, style_gsheet
,
style_plyr
, style_purrr
,
style_tidyr
A style extracted from a popular package, included for convenience
style_fbar
style_fbar
An object of class tbl_df
(inherits from tbl
, data.frame
) with 13 rows and 4 columns.
Other bundled_styles: style_adaptalint
,
style_dplyr
, style_gsheet
,
style_plyr
, style_purrr
,
style_tidyr
A style extracted from a popular package, included for convenience
style_gsheet
style_gsheet
An object of class tbl_df
(inherits from tbl
, data.frame
) with 8 rows and 4 columns.
Other bundled_styles: style_adaptalint
,
style_dplyr
, style_fbar
,
style_plyr
, style_purrr
,
style_tidyr
A style extracted from a popular package, included for convenience
style_plyr
style_plyr
An object of class tbl_df
(inherits from tbl
, data.frame
) with 7 rows and 4 columns.
Other bundled_styles: style_adaptalint
,
style_dplyr
, style_fbar
,
style_gsheet
, style_purrr
,
style_tidyr
A style extracted from a popular package, included for convenience
style_purrr
style_purrr
An object of class tbl_df
(inherits from tbl
, data.frame
) with 9 rows and 4 columns.
Other bundled_styles: style_adaptalint
,
style_dplyr
, style_fbar
,
style_gsheet
, style_plyr
,
style_tidyr
A style extracted from a popular package, included for convenience
style_tidyr
style_tidyr
An object of class tbl_df
(inherits from tbl
, data.frame
) with 7 rows and 4 columns.
Other bundled_styles: style_adaptalint
,
style_dplyr
, style_fbar
,
style_gsheet
, style_plyr
,
style_purrr