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 |
Run 'pylint' on a file or a folder.
pylint(modules)
pylint(modules)
modules |
one or more Python files, or a folder containing Python files |
A htmlwidget
object.
## 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)
## 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)
Output and render functions for using 'pylintR' within Shiny applications and interactive Rmd documents.
pylintROutput(outputId, width = "100%", height = "400px") renderPylintR(expr, env = parent.frame(), quoted = FALSE)
pylintROutput(outputId, width = "100%", height = "400px") renderPylintR(expr, env = parent.frame(), quoted = FALSE)
outputId |
output variable to read from |
width , height
|
a valid CSS unit (like |
expr |
an expression that generates an output of |
env |
the environment in which to evaluate |
quoted |
whether |
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.