pylint: Run 'pylint' on a file or a folder

Description Usage Arguments Value Examples

View source: R/pylintR.R

Description

Run 'pylint' on a file or a folder.

Usage

1
pylint(modules)

Arguments

modules

one or more Python files, or a folder containing Python files

Value

A htmlwidget object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
sample_code_file <- system.file("sample_code.py", package = "pylintR")
code_lines <- readLines(sample_code_file)
nlines <- length(code_lines)
# Here is the code:
cat(paste0(format(seq_len(nlines), width = 2), ") ", code_lines), sep = "\n")
# let's copy this Python file in a temporary folder
file_copy <- tempfile(fileext = ".py")
file.copy(sample_code_file, file_copy)
wd <- setwd(tempdir())
# let's lint it with pylint:
pylint(basename(file_copy))
# restore current directory
setwd(wd)

## End(Not run)

pylintR documentation built on Oct. 12, 2021, 9:07 a.m.

Related to pylint in pylintR...