- Simplified the configuration retrieval in
src/config.ts
and refactored thecreateDiagnostics
function insrc/diagnostics.ts
to improve readability and maintainability. ThecreateDiagnostics
function now also takes into account theshowErrors
configuration setting when creating diagnostic messages from errors. - Simplified
extension.ts
by moving thehandlePythonDocument
function toworkspace.ts
and using theprocessWorkspaces
function for linting and handling of configuration change events. The handling of document change and open events now uses thehandleDocumentEvent
function. - Improved documentation and refactored
executeRadon
function insrc/radon.ts
to construct command arguments in a more structured way. Improved error handling inexecuteRadon
andprocessRadonOutput
functions. TheprocessRadonOutput
function now handles file paths in a more robust way. - In
src/radonTypes.ts
, theRadonBlock
andRadonOutput
definitions have been changed from interfaces to types, allowing them to be used in more flexible ways, such as in union types or mapped types. Added semicolons at the end of these type definitions. - Refactored the
processPythonFiles
andprocessAllWorkspaceFolders
functions to use theArray.filter
andArray.forEach
methods instead of a for loop. TheprocessAllWorkspaceFolders
function now also returns a Promise that resolves to void.
-
From
extension.ts
:- Removed the inline definition of
handlePythonDocument
function. - Removed
reloadConfig
import as it's no longer used.
- Removed the inline definition of
-
Replaced direct calls to
processAllWorkspaceFolders
andhandlePythonDocument
with a new queue-based approach. -
In
processRadonOutput
function:- Removed unnecessary array check. The function now assumes that the
filePaths
variable is always an array.
- Removed unnecessary array check. The function now assumes that the
-
Cleaned up
processWorkspace
,processFile
,processPythonFiles
, andprocessAllWorkspaceFolders
functions:
-
Introduced a new configuration option "vscodeRadonLinter.showErrors" in
package.json
. This option, when set to true, will display errors identified by the Radon tool. -
Added "*.pyx" and "cpython" to the default glob patterns for files and folders to exclude in
package.json
. -
Added new imports to
extension.ts
:handlePythonDocument
fromworkspace.ts
PromiseQueue
-
Introduced a new PromiseQueue to handle tasks in a queue.
-
Added new functions:
processWorkspaces
to process all workspace folders and add them to the queue.handleDocumentEvent
to handle document events and add them to the queue.handlePythonDocument
to handle Python documents. This function takes a document, a diagnostic collection, and an action performed on the document as parameters. It checks if the document is a Python file and if so, it processes the file for linting.
-
Added detailed comments to the following functions explaining their purpose, parameters, and return value:
processRadonOutput
processWorkspace
processFile
processPythonFiles
processAllWorkspaceFolders
-
Enhanced logging in
processRadon
function. The function now logs the target path if the "debug" configuration option is set to true.
- Modified default ignore patterns in
package.json
.
- Improved error handling in
src/diagnostics.ts
. - Updated the
createDiagnostics
function insrc/diagnostics.ts
to handle different types ofradonOutput
.- Added a check to ensure
radonOutput
is an array before processing. - Added handling for
radonOutput
being an object with anerror
property. - In case of an error, a diagnostic with severity
Error
is created, with the line number extracted from the error message.
- Added a check to ensure
- Fixed the order of parameters in the Radon executable command in
src/radon.ts
. - Added logging for debugging in
src/radon.ts
. - Fixed handling of file paths in
src/radon.ts
.
- New configuration options in
package.json
:vscodeRadonLinter.minComplexityRank
: The minimum complexity rank for Radon linter.vscodeRadonLinter.excludeFiles
: Glob patterns for files to exclude.vscodeRadonLinter.ignoreFolders
: Glob patterns for folders to ignore.vscodeRadonLinter.showRadonPathWarning
: Show a warning message to recheck the path to the radon executable.
- In
src/extension.ts
, added a check for theshowRadonPathWarning
configuration. If true, it shows an information message asking the user to recheck the path to the radon executable. - In
src/radon.ts
, added new parameters to theexecuteRadon
function:minComplexityRank
,excludeFiles
, andignoreFolders
. These parameters are used in the Radon command execution.
- Updated the
vscodeRadonLinter.radonExecutable
default value inpackage.json
fromradon cc -j
toradon
. - In
src/radon.ts
, updated theexecuteRadon
function to include the new parameters in the Radon command execution. - Updated the
processRadon
function insrc/radon.ts
to fetch the new configuration options and pass them to theexecuteRadon
function.
- Fixed the Radon command execution in
src/radon.ts
to properly handle the exclusion of files and folders, and to consider the minimum complexity rank.