Package 'adaptalint'

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

Help Index


Find style of a package

Description

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.

Usage

extract_package_style(package)

Arguments

package

path to the package of interest

Value

a data_frame with columns lint, count, total_lints and adjusted


Find style of a file

Description

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.

Usage

extract_style(filename)

Arguments

filename

path to the file of interest

Value

a data_frame with columns lint, count, total_lints and adjusted

Examples

# 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)

Lint a package, using a known style

Description

Apply a style extracted using extract_style, in order to check for only the style issues that aren't excepted in that package.

Usage

lint_package_with_style(package, style, threshold = 0.01)

Arguments

package

path to the package to check

style

a style data frame, as created by extract_style

threshold

the proportional occurrence threshold above which a lint is ignored


Lint a file, using a known style

Description

Apply a style extracted using extract_style: lint a file, checking only for errors that appear to be prohibited in that style.

Usage

lint_with_style(filename, style, threshold = 0.01)

Arguments

filename

path to the file to check

style

a style data frame, as created by extract_style

threshold

the proportional occurrence threshold above which a lint is ignored

Examples

# 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

Description

A style extracted from a popular package, included for convenience

Usage

style_adaptalint

Format

An object of class tbl_df (inherits from tbl, data.frame) with 2 rows and 4 columns.

See Also

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

Description

A style extracted from a popular package, included for convenience

Usage

style_dplyr

Format

An object of class tbl_df (inherits from tbl, data.frame) with 14 rows and 4 columns.

See Also

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

Description

A style extracted from a popular package, included for convenience

Usage

style_fbar

Format

An object of class tbl_df (inherits from tbl, data.frame) with 13 rows and 4 columns.

See Also

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

Description

A style extracted from a popular package, included for convenience

Usage

style_gsheet

Format

An object of class tbl_df (inherits from tbl, data.frame) with 8 rows and 4 columns.

See Also

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

Description

A style extracted from a popular package, included for convenience

Usage

style_plyr

Format

An object of class tbl_df (inherits from tbl, data.frame) with 7 rows and 4 columns.

See Also

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

Description

A style extracted from a popular package, included for convenience

Usage

style_purrr

Format

An object of class tbl_df (inherits from tbl, data.frame) with 9 rows and 4 columns.

See Also

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

Description

A style extracted from a popular package, included for convenience

Usage

style_tidyr

Format

An object of class tbl_df (inherits from tbl, data.frame) with 7 rows and 4 columns.

See Also

Other bundled_styles: style_adaptalint, style_dplyr, style_fbar, style_gsheet, style_plyr, style_purrr