Package 'pylintR'

Title: Lint 'Python' Files with a R Command or a 'RStudio' Addin
Description: Allow to run 'pylint' on Python files with a R command or a 'RStudio' addin. The report appears in the RStudio viewer pane as a formatted HTML file.
Authors: Stéphane Laurent
Maintainer: Stéphane Laurent <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2024-10-24 02:42:12 UTC
Source: https://github.com/stla/pylintr

Help Index


Run 'pylint' on a file or a folder

Description

Run 'pylint' on a file or a folder.

Usage

pylint(modules)

Arguments

modules

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

Value

A htmlwidget object.

Examples

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

Shiny bindings for pylintR

Description

Output and render functions for using 'pylintR' within Shiny applications and interactive Rmd documents.

Usage

pylintROutput(outputId, width = "100%", height = "400px")

renderPylintR(expr, env = parent.frame(), quoted = FALSE)

Arguments

outputId

output variable to read from

width, height

a valid CSS unit (like "100%", "400px", "auto") or a number, which will be coerced to a string and have "px" appended

expr

an expression that generates an output of pylint

env

the environment in which to evaluate expr

quoted

whether expr is a quoted expression (with quote()); this is useful if you want to save an expression in a variable

Value

pylintROutput returns an output element that can be included in a Shiny UI definition, and renderPylintR returns a shiny.render.function object that can be included in a Shiny server definition.