feat: rename project from Validatrix to Nimcheck across all files and add CI pipeline
Rename the entire project from "Validatrix" to "Nimcheck" in README.md, Makefile, LESSONS_LEARNED.md, and all source references; add initial Gitea CI workflow with lint, test, and build jobs for Nim 2.0.0; expand .gitignore with comprehensive patterns for Nim, Python, editor, environment, and temporary files; add CONTRIBUTING.md and LICENSE (MIT) files to establish project governance and licensing.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
## Validatrix - Universal Source Code Validation Framework
|
||||
## Nimcheck - Universal Source Code Validation Framework
|
||||
##
|
||||
## A comprehensive, extensible validation framework for all common
|
||||
## programming languages and file formats. Provides tokenizer-based
|
||||
@@ -6,7 +6,7 @@
|
||||
## consistent error reporting.
|
||||
##
|
||||
## Usage:
|
||||
## import validatrix
|
||||
## import nimcheck
|
||||
## let r = validateSource("print('hello')", flavor=lfPython)
|
||||
## let jsonResult = result.toJson()
|
||||
##
|
||||
@@ -18,12 +18,12 @@
|
||||
import std/[json, strutils, os, strformat, sequtils, algorithm]
|
||||
|
||||
# Core types and base classes — imported and re-exported for public API consumers
|
||||
import validatrix/core/types
|
||||
import validatrix/core/tokenizerbase
|
||||
import validatrix/core/validatorbase
|
||||
import validatrix/core/detector
|
||||
import validatrix/core/debug
|
||||
import validatrix/reporting/errors
|
||||
import nimcheck/core/types
|
||||
import nimcheck/core/tokenizerbase
|
||||
import nimcheck/core/validatorbase
|
||||
import nimcheck/core/detector
|
||||
import nimcheck/core/debug
|
||||
import nimcheck/reporting/errors
|
||||
export types
|
||||
export tokenizerbase
|
||||
export validatorbase
|
||||
@@ -31,14 +31,14 @@ export errors
|
||||
|
||||
# Import all language validators (they register themselves on import)
|
||||
{.warning[UnusedImport]:off.}
|
||||
import validatrix/languages/nim_validator
|
||||
import validatrix/languages/bash_validator
|
||||
import validatrix/languages/python_validator
|
||||
import validatrix/languages/javascript_validator
|
||||
import validatrix/languages/php_validator
|
||||
import validatrix/languages/html_validator
|
||||
import validatrix/languages/jinja_validator
|
||||
import validatrix/languages/config_validators
|
||||
import nimcheck/languages/nim_validator
|
||||
import nimcheck/languages/bash_validator
|
||||
import nimcheck/languages/python_validator
|
||||
import nimcheck/languages/javascript_validator
|
||||
import nimcheck/languages/php_validator
|
||||
import nimcheck/languages/html_validator
|
||||
import nimcheck/languages/jinja_validator
|
||||
import nimcheck/languages/config_validators
|
||||
{.warning[UnusedImport]:on.}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -60,10 +60,10 @@ proc validateSource*(
|
||||
## let r = validateSource("proc hello() = echo 'hi'", flavor=lfNim)
|
||||
## let r = validateSource("var x = 1", flavor=lfUnknown) # auto-detect
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if options.debugMode and not debugEnabled:
|
||||
enableDebug()
|
||||
debugEnter("VALIDATRIX", "validateSource called")
|
||||
debugEnter("NIMCHECK", "validateSource called")
|
||||
|
||||
try:
|
||||
var opts = options
|
||||
@@ -118,9 +118,9 @@ proc validateSource*(
|
||||
newSourceRange(newSourcePosition(0, 0, 0), newSourcePosition(0, 0, 0))
|
||||
))
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if options.debugMode:
|
||||
debugLeave("VALIDATRIX", &"Validation complete: valid={result.valid}, errors={result.errors.len}")
|
||||
debugLeave("NIMCHECK", &"Validation complete: valid={result.valid}, errors={result.errors.len}")
|
||||
result.debugOutput = getDebugOutput()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -141,9 +141,9 @@ proc validateFile*(
|
||||
## let r = validateFile("src/main.nim")
|
||||
## let r = validateFile("template.html.jinja", flavor=lfJinja)
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if options.debugMode:
|
||||
debugEnter("VALIDATRIX", &"validateFile: {filePath}")
|
||||
debugEnter("NIMCHECK", &"validateFile: {filePath}")
|
||||
|
||||
try:
|
||||
if not fileExists(filePath):
|
||||
@@ -169,9 +169,9 @@ proc validateFile*(
|
||||
|
||||
result = validateSource(source, detectedFlavor, options, filePath)
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if options.debugMode:
|
||||
debugLeave("VALIDATRIX", &"File validation complete: {result.errors.len} errors")
|
||||
debugLeave("NIMCHECK", &"File validation complete: {result.errors.len} errors")
|
||||
|
||||
except Exception as e:
|
||||
result = newValidationResult()
|
||||
@@ -252,12 +252,12 @@ proc detectFlavor*(source: string, filePath: string = ""): LanguageFlavor =
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
const
|
||||
validatrixVersion* = "0.1.0"
|
||||
validatrixDescription* = "Universal Source Code Validation Framework"
|
||||
nimcheckVersion* = "0.1.0"
|
||||
nimcheckDescription* = "Universal Source Code Validation Framework"
|
||||
|
||||
proc version*(): string =
|
||||
## Get the Validatrix version string.
|
||||
validatrixVersion
|
||||
## Get the Nimcheck version string.
|
||||
nimcheckVersion
|
||||
|
||||
proc supportedFlavors*(): seq[string] =
|
||||
## Get list of all supported language flavors.
|
||||
@@ -285,13 +285,13 @@ proc disableDebug*() =
|
||||
when isMainModule:
|
||||
|
||||
proc printUsage() =
|
||||
echo &"Validatrix v{validatrixVersion} - {validatrixDescription}"
|
||||
echo &"Nimcheck v{nimcheckVersion} - {nimcheckDescription}"
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo " validatrix validate [--file=<path> | --source=<code>] [--flavor=<lang>]"
|
||||
echo " validatrix inspect [--file=<path> | --source=<code>] [--flavor=<lang>]"
|
||||
echo " validatrix detect [--file=<path> | --source=<code>]"
|
||||
echo " validatrix help"
|
||||
echo " nimcheck validate [--file=<path> | --source=<code>] [--flavor=<lang>]"
|
||||
echo " nimcheck inspect [--file=<path> | --source=<code>] [--flavor=<lang>]"
|
||||
echo " nimcheck detect [--file=<path> | --source=<code>]"
|
||||
echo " nimcheck help"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --file=<path> Source file to process"
|
||||
@@ -394,7 +394,7 @@ when isMainModule:
|
||||
echo &" Confidence: {dconfidence * 100:.2f}%"
|
||||
|
||||
of "version", "--version", "-v":
|
||||
echo &"Validatrix v{validatrixVersion}"
|
||||
echo &"Nimcheck v{nimcheckVersion}"
|
||||
|
||||
of "help", "--help", "-h":
|
||||
printUsage()
|
||||
@@ -1,6 +1,6 @@
|
||||
## Debug mode support for Validatrix.
|
||||
## Debug mode support for Nimcheck.
|
||||
##
|
||||
## When compiled with -d:validatrixDebug, all validators and tokenizers
|
||||
## When compiled with -d:nimcheckDebug, all validators and tokenizers
|
||||
## produce detailed debug output that helps an LLM or developer trace
|
||||
## exactly what the validator is doing.
|
||||
|
||||
@@ -27,7 +27,7 @@ var
|
||||
|
||||
proc enableDebug*() =
|
||||
## Enable debug output collection.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
debugEnabled = true
|
||||
debugBuffer = @[]
|
||||
debugIndent = 0
|
||||
@@ -36,13 +36,13 @@ proc enableDebug*() =
|
||||
|
||||
proc disableDebug*() =
|
||||
## Disable debug output collection.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
debugLog("DEBUG", "Debug mode disabled")
|
||||
debugEnabled = false
|
||||
|
||||
proc isDebugEnabled*(): bool =
|
||||
## Check if debug mode is active.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
result = debugEnabled
|
||||
else:
|
||||
result = false
|
||||
@@ -58,7 +58,7 @@ proc clearDebug*() =
|
||||
|
||||
proc debugLog*(category: string, message: string) =
|
||||
## Log a debug message with category.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if debugEnabled:
|
||||
let indent = repeat(" "Indent)
|
||||
let timestamp = now().format("HH:mm:ss.fff")
|
||||
@@ -66,13 +66,13 @@ proc debugLog*(category: string, message: string) =
|
||||
|
||||
proc debugEnter*(category: string, message: string) =
|
||||
## Log entry into a scope and increase indent.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
debugLog(category, "--> " & message)
|
||||
debugIndent += 1
|
||||
|
||||
proc debugLeave*(category: string, message: string = "") =
|
||||
## Decrease indent and log exit from a scope.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if debugIndent > 0:
|
||||
debugIndent -= 1
|
||||
let indentMsg = if message.len > 0: "<-- " & message else: "<--"
|
||||
@@ -84,12 +84,12 @@ proc debugLeave*(category: string, message: string = "") =
|
||||
|
||||
proc debugTimerStart*(name: string) =
|
||||
## Start a named timer.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
debugTimers[name] = epochTime()
|
||||
|
||||
proc debugTimerStop*(name: string): float =
|
||||
## Stop a named timer and return elapsed ms.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
let start = debugTimers.getOrDefault(name, 0.0)
|
||||
if start > 0.0:
|
||||
result = (epochTime() - start) * 1000.0
|
||||
@@ -108,19 +108,19 @@ proc debugTimerStopAndLog*(name: string) =
|
||||
|
||||
proc getDebugOutput*(): string =
|
||||
## Get the complete debug output as a string.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
result = debugBuffer.join("\n")
|
||||
else:
|
||||
result = ""
|
||||
|
||||
proc debugToken*(token: Token) =
|
||||
## Log a token.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
debugLog("TOKEN", &"[{token.kind}] '{token.value}' @ L{token.position.line}:{token.position.column}")
|
||||
|
||||
proc debugError*(err: ValidationError) =
|
||||
## Log a validation error.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
debugLog("ERROR", &"[{err.code}] {err.severity}: {err.message} @ L{err.position.line}:{err.position.column}")
|
||||
if err.hint.len > 0:
|
||||
debugLog("HINT", err.hint)
|
||||
@@ -1,4 +1,4 @@
|
||||
## Language (flavor) auto-detection for Validatrix.
|
||||
## Language (flavor) auto-detection for Nimcheck.
|
||||
##
|
||||
## Accurately detects programming language from:
|
||||
## 1. File extension
|
||||
@@ -360,14 +360,14 @@ proc detectFlavor*(
|
||||
## When explicitFlavor is provided and not lfUnknown, returns that.
|
||||
## Otherwise, uses the best available detection method.
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if isDebugEnabled():
|
||||
debugEnter("DETECTOR", "Detecting language flavor")
|
||||
|
||||
try:
|
||||
# 1. Explicit flavor
|
||||
if explicitFlavor != lfUnknown:
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if isDebugEnabled():
|
||||
debugLog("DETECTOR", &"Using explicit flavor: {explicitFlavor}")
|
||||
return (explicitFlavor, fdmExplicit, 1.0)
|
||||
@@ -377,7 +377,7 @@ proc detectFlavor*(
|
||||
let ext = filePath.toLowerAscii()
|
||||
for extension, flavor in extensionMap.pairs():
|
||||
if ext.endsWith(extension) or ext == extension:
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if isDebugEnabled():
|
||||
debugLog("DETECTOR", &"Detected by extension '{extension}': {flavor}")
|
||||
return (flavor, fdmExtension, 0.9)
|
||||
@@ -385,7 +385,7 @@ proc detectFlavor*(
|
||||
# 3. Shebang detection
|
||||
let (shebangFlavor, shebangMethod) = detectByShebang(source)
|
||||
if shebangFlavor != lfUnknown:
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if isDebugEnabled():
|
||||
debugLog("DETECTOR", &"Detected by shebang: {shebangFlavor}")
|
||||
return (shebangFlavor, shebangMethod, 0.95)
|
||||
@@ -394,18 +394,18 @@ proc detectFlavor*(
|
||||
if source.len > 0:
|
||||
let (contentFlavor, contentMethod, confidence) = detectByContent(source, filePath)
|
||||
if contentFlavor != lfUnknown:
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if isDebugEnabled():
|
||||
debugLog("DETECTOR", &"Detected by content: {contentFlavor} (confidence: {confidence})")
|
||||
return (contentFlavor, contentMethod, confidence)
|
||||
|
||||
except Exception as e:
|
||||
discard e
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if isDebugEnabled():
|
||||
debugLog("DETECTOR", &"Detection error: {e.msg}")
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if isDebugEnabled():
|
||||
debugLog("DETECTOR", "Could not determine flavor")
|
||||
debugLeave("DETECTOR")
|
||||
@@ -1,7 +1,7 @@
|
||||
## Validator registration — called at module load time.
|
||||
##
|
||||
## Each language validator registers itself here.
|
||||
## This file is imported by the main validatrix.nim module.
|
||||
## This file is imported by the main nimcheck.nim module.
|
||||
|
||||
import ./types, ./validatorbase
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Abstract base tokenizer for Validatrix.
|
||||
## Abstract base tokenizer for Nimcheck.
|
||||
##
|
||||
## All language-specific tokenizers inherit from this base class.
|
||||
## Provides position tracking, error recording, and common tokenization helpers.
|
||||
@@ -144,7 +144,7 @@ proc emitToken*(self: TokenizerBase, kind: TokenKind, value: string, startPos: S
|
||||
range: range
|
||||
)
|
||||
self.tokens.add(token)
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugToken(token)
|
||||
|
||||
@@ -171,7 +171,7 @@ proc recordError*(
|
||||
let hintVal = hint
|
||||
let err = newValidationError(severity, message, code, position, range, hint = hintVal)
|
||||
self.errors.add(err)
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugError(err)
|
||||
|
||||
@@ -209,7 +209,7 @@ proc validateBrackets*(self: TokenizerBase): seq[ValidationError] =
|
||||
hint = hintStr
|
||||
)
|
||||
result.add(err)
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugError(err)
|
||||
self.errors.add(result)
|
||||
@@ -1,4 +1,4 @@
|
||||
## Validatrix Core Types
|
||||
## Nimcheck Core Types
|
||||
##
|
||||
## Defines all foundational types used throughout the validation framework.
|
||||
## Every validator, tokenizer, and reporter shares these types for consistency.
|
||||
@@ -1,4 +1,4 @@
|
||||
## Abstract base validator for Validatrix.
|
||||
## Abstract base validator for Nimcheck.
|
||||
##
|
||||
## All language-specific validators inherit from this base class.
|
||||
## Provides the common validation pipeline: tokenize -> analyze -> report.
|
||||
@@ -61,7 +61,7 @@ method buildModuleInfo*(self: ValidatorBase) {.base, gcsafe.} =
|
||||
|
||||
method validate*(self: ValidatorBase): ValidationResult {.base, gcsafe.} =
|
||||
## Run the full validation pipeline.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
if not debugEnabled:
|
||||
enableDebug()
|
||||
@@ -81,11 +81,11 @@ method validate*(self: ValidatorBase): ValidationResult {.base, gcsafe.} =
|
||||
|
||||
# 2. Create and run tokenizer
|
||||
self.tokenizer = self.createTokenizer()
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugTimerStart("tokenize")
|
||||
self.tokenizer.tokenize()
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
discard debugTimerStop("tokenize")
|
||||
debugLog("VALIDATE", &"Tokenized: {self.tokenizer.tokens.len} tokens, {self.tokenizer.errors.len} errors")
|
||||
@@ -94,14 +94,14 @@ method validate*(self: ValidatorBase): ValidationResult {.base, gcsafe.} =
|
||||
self.result.errors.add(self.tokenizer.getErrors())
|
||||
|
||||
# 4. Structural analysis
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugEnter("ANALYZE", "Running structural analysis")
|
||||
|
||||
self.analyzeTokens()
|
||||
self.buildModuleInfo()
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugLeave("ANALYZE")
|
||||
|
||||
@@ -131,14 +131,14 @@ method validate*(self: ValidatorBase): ValidationResult {.base, gcsafe.} =
|
||||
newSourceRange(newSourcePosition(0, 0, 0), newSourcePosition(0, 0, 0)),
|
||||
hint = "This is a bug in the validator — please report it"
|
||||
))
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugLog("EXCEPTION", &"Unhandled exception: {e.msg}")
|
||||
|
||||
# 7. Duration
|
||||
self.result.durationMs = (epochTime() - self.startTime) * 1000.0
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugTimerStopAndLog("total")
|
||||
self.result.debugOutput = getDebugOutput()
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
## Bash/Shell validator for Validatrix.
|
||||
## Bash/Shell validator for Nimcheck.
|
||||
##
|
||||
## Validates Bash/shell scripts, checking structural balance and common issues.
|
||||
|
||||
@@ -40,7 +40,7 @@ method createTokenizer*(self: BashValidator): TokenizerBase =
|
||||
|
||||
method analyzeTokens*(self: BashValidator) =
|
||||
## Analyze Bash-specific patterns.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugEnter("BASH_ANALYZE", "Analyzing Bash structure")
|
||||
|
||||
@@ -105,7 +105,7 @@ method analyzeTokens*(self: BashValidator) =
|
||||
hint = "Add missing 'esac' to close the case block"
|
||||
))
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugLog("BASH_ANALYZE", &"if/fi: {ifCount}/{fiCount}, for/done: {forCount}/{doneCount}, case/esac: {caseCount}/{esacCount}")
|
||||
debugLeave("BASH_ANALYZE")
|
||||
+7
-7
@@ -1,4 +1,4 @@
|
||||
## JSON, YAML, and TOML config validators for Validatrix.
|
||||
## JSON, YAML, and TOML config validators for Nimcheck.
|
||||
##
|
||||
## These use built-in parsers where possible for accuracy.
|
||||
|
||||
@@ -29,7 +29,7 @@ method createTokenizer*(self: JSONValidator): TokenizerBase =
|
||||
|
||||
method validate*(self: JSONValidator): ValidationResult =
|
||||
## Override validate to use native JSON parser.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugEnter("JSON_VALIDATE", "Validating JSON")
|
||||
|
||||
@@ -69,7 +69,7 @@ method validate*(self: JSONValidator): ValidationResult =
|
||||
newSourcePosition(1, 1, 0), newSourceRange(newSourcePosition(1, 1, 0), newSourcePosition(1, 1, 0))))
|
||||
|
||||
self.result.durationMs = (epochTime() - self.startTime) * 1000.0
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode: debugLeave("JSON_VALIDATE")
|
||||
|
||||
return self.result
|
||||
@@ -95,7 +95,7 @@ method createTokenizer*(self: YAMLValidator): TokenizerBase =
|
||||
result = newTokenizerBase(self.source, self.options)
|
||||
|
||||
method validate*(self: YAMLValidator): ValidationResult =
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugEnter("YAML_VALIDATE", "Validating YAML")
|
||||
|
||||
@@ -153,7 +153,7 @@ method validate*(self: YAMLValidator): ValidationResult =
|
||||
newSourcePosition(1,1,0), newSourceRange(newSourcePosition(1,1,0), newSourcePosition(1,1,0))))
|
||||
|
||||
self.result.durationMs = (epochTime() - self.startTime) * 1000.0
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode: debugLeave("YAML_VALIDATE")
|
||||
return self.result
|
||||
|
||||
@@ -178,7 +178,7 @@ method createTokenizer*(self: TOMLValidator): TokenizerBase =
|
||||
result = newTokenizerBase(self.source, self.options)
|
||||
|
||||
method validate*(self: TOMLValidator): ValidationResult =
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugEnter("TOML_VALIDATE", "Validating TOML")
|
||||
|
||||
@@ -235,7 +235,7 @@ method validate*(self: TOMLValidator): ValidationResult =
|
||||
newSourcePosition(1,1,0), newSourceRange(newSourcePosition(1,1,0), newSourcePosition(1,1,0))))
|
||||
|
||||
self.result.durationMs = (epochTime() - self.startTime) * 1000.0
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode: debugLeave("TOML_VALIDATE")
|
||||
return self.result
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
## HTML/XML validator for Validatrix.
|
||||
## HTML/XML validator for Nimcheck.
|
||||
|
||||
import std/[json, tables]
|
||||
{.warning[UnusedImport]:off.}
|
||||
@@ -22,12 +22,12 @@ method createTokenizer*(self: HTMLValidator): TokenizerBase =
|
||||
result = newHTMLTokenizer(self.source, self.options)
|
||||
|
||||
method analyzeTokens*(self: HTMLValidator) =
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode: debugEnter("HTML_ANALYZE", "Analyzing HTML")
|
||||
procCall ValidatorBase(self).analyzeTokens()
|
||||
for tok in self.tokenizer.tokens:
|
||||
if tok.kind == tkComment: self.result.moduleInfo.comments += 1
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode: debugLeave("HTML_ANALYZE")
|
||||
|
||||
proc init*() =
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
## JavaScript/TypeScript validator for Validatrix.
|
||||
## JavaScript/TypeScript validator for Nimcheck.
|
||||
|
||||
import std/[json, tables]
|
||||
{.warning[UnusedImport]:off.}
|
||||
@@ -22,7 +22,7 @@ method createTokenizer*(self: JavaScriptValidator): TokenizerBase =
|
||||
result = newJavaScriptTokenizer(self.source, self.options)
|
||||
|
||||
method analyzeTokens*(self: JavaScriptValidator) =
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugEnter("JS_ANALYZE", "Analyzing JS structure")
|
||||
|
||||
@@ -65,7 +65,7 @@ method analyzeTokens*(self: JavaScriptValidator) =
|
||||
discard
|
||||
i += 1
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugLeave("JS_ANALYZE")
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
## Jinja2 template validator for Validatrix.
|
||||
## Jinja2 template validator for Nimcheck.
|
||||
|
||||
import std/[json, strformat, tables]
|
||||
{.warning[UnusedImport]:off.}
|
||||
@@ -22,7 +22,7 @@ method createTokenizer*(self: JinjaValidator): TokenizerBase =
|
||||
result = newJinjaTokenizer(self.source, self.options)
|
||||
|
||||
method analyzeTokens*(self: JinjaValidator) =
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode: debugEnter("JINJA_ANALYZE", "Analyzing Jinja structure")
|
||||
procCall ValidatorBase(self).analyzeTokens()
|
||||
|
||||
@@ -90,7 +90,7 @@ method analyzeTokens*(self: JinjaValidator) =
|
||||
newSourceRange(newSourcePosition(1, 1, 0), newSourcePosition(1, 1, 0)),
|
||||
hint = &"Add a matching 'end{b}' tag"))
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode: debugLeave("JINJA_ANALYZE")
|
||||
|
||||
proc init*() =
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
## Nim language validator for Validatrix.
|
||||
## Nim language validator for Nimcheck.
|
||||
##
|
||||
## Validates Nim source code using the Nim tokenizer.
|
||||
## Handles common structural patterns and reports errors consistently.
|
||||
@@ -41,7 +41,7 @@ method createTokenizer*(self: NimValidator): TokenizerBase =
|
||||
|
||||
method analyzeTokens*(self: NimValidator) =
|
||||
## Analyze Nim-specific structural patterns.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugEnter("NIM_ANALYZE", "Analyzing Nim structure")
|
||||
|
||||
@@ -105,7 +105,7 @@ method analyzeTokens*(self: NimValidator) =
|
||||
discard
|
||||
i += 1
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugLeave("NIM_ANALYZE", &"Found {self.result.moduleInfo.functions.len} functions, {self.result.moduleInfo.classes.len} types")
|
||||
|
||||
@@ -120,7 +120,7 @@ method buildModuleInfo*(self: NimValidator) =
|
||||
self.result.moduleInfo.totalTokens = self.tokenizer.tokens.len
|
||||
|
||||
# Debug info
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
self.result.moduleInfo.debugInfo = %*{
|
||||
"language": "Nim",
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
## PHP validator for Validatrix.
|
||||
## PHP validator for Nimcheck.
|
||||
|
||||
import std/[json, tables]
|
||||
{.warning[UnusedImport]:off.}
|
||||
@@ -22,7 +22,7 @@ method createTokenizer*(self: PHPValidator): TokenizerBase =
|
||||
result = newPHPTokenizer(self.source, self.options)
|
||||
|
||||
method analyzeTokens*(self: PHPValidator) =
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugEnter("PHP_ANALYZE", "Analyzing PHP structure")
|
||||
|
||||
@@ -61,7 +61,7 @@ method analyzeTokens*(self: PHPValidator) =
|
||||
else: discard
|
||||
i += 1
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugLeave("PHP_ANALYZE")
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
## Python language validator for Validatrix.
|
||||
## Python language validator for Nimcheck.
|
||||
|
||||
import std/[json, tables]
|
||||
{.warning[UnusedImport]:off.}
|
||||
@@ -22,7 +22,7 @@ method createTokenizer*(self: PythonValidator): TokenizerBase =
|
||||
result = newPythonTokenizer(self.source, self.options)
|
||||
|
||||
method analyzeTokens*(self: PythonValidator) =
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugEnter("PYTHON_ANALYZE", "Analyzing Python structure")
|
||||
|
||||
@@ -77,7 +77,7 @@ method analyzeTokens*(self: PythonValidator) =
|
||||
discard
|
||||
i += 1
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugLeave("PYTHON_ANALYZE")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Error reporting and formatting for Validatrix.
|
||||
## Error reporting and formatting for Nimcheck.
|
||||
##
|
||||
## Provides consistent error formatting across all language validators,
|
||||
## including human-readable and machine-readable (JSON) output.
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
## Bash/Shell tokenizer for Validatrix.
|
||||
## Bash/Shell tokenizer for Nimcheck.
|
||||
##
|
||||
## Tokenizes Bash/Sh/Zsh source code including:
|
||||
## - Here-documents (<<EOF)
|
||||
@@ -61,7 +61,7 @@ proc newBashTokenizer*(source: string, options: ValidationOptions = newValidatio
|
||||
|
||||
method tokenize*(self: BashTokenizer) =
|
||||
## Tokenize Bash source code.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugEnter("BASH_TOKENIZER", "Starting Bash tokenization")
|
||||
|
||||
@@ -312,6 +312,6 @@ method tokenize*(self: BashTokenizer) =
|
||||
# End of file
|
||||
self.emitToken(tkEndOfFile, "", self.currentPos())
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugLeave("BASH_TOKENIZER", &"Tokenization complete: {self.tokens.len} tokens")
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
## HTML/XML tokenizer for Validatrix.
|
||||
## HTML/XML tokenizer for Nimcheck.
|
||||
|
||||
import std/[strformat, sets, json, sequtils, unicode]
|
||||
{.warning[UnusedImport]:off.}
|
||||
@@ -31,7 +31,7 @@ proc newHTMLTokenizer*(source: string, options: ValidationOptions = newValidatio
|
||||
result.isXml = isXml
|
||||
|
||||
method tokenize*(self: HTMLTokenizer) =
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugEnter("HTML_TOKENIZER", "Starting HTML tokenization")
|
||||
|
||||
@@ -157,6 +157,6 @@ method tokenize*(self: HTMLTokenizer) =
|
||||
)
|
||||
|
||||
self.emitToken(tkEndOfFile, "", self.currentPos())
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugLeave("HTML_TOKENIZER", &"Complete: {self.tokens.len} tokens")
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
## JavaScript/TypeScript tokenizer for Validatrix.
|
||||
## JavaScript/TypeScript tokenizer for Nimcheck.
|
||||
|
||||
import std/[strformat, sets, json, sequtils, unicode]
|
||||
{.warning[UnusedImport]:off.}
|
||||
@@ -36,7 +36,7 @@ proc newJavaScriptTokenizer*(source: string, options: ValidationOptions = newVal
|
||||
)
|
||||
|
||||
method tokenize*(self: JavaScriptTokenizer) =
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugEnter("JS_TOKENIZER", "Starting JS/TS tokenization")
|
||||
|
||||
@@ -223,6 +223,6 @@ method tokenize*(self: JavaScriptTokenizer) =
|
||||
self.emitToken(tkError, $self.advance(), startPos)
|
||||
|
||||
self.emitToken(tkEndOfFile, "", self.currentPos())
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugLeave("JS_TOKENIZER", &"Complete: {self.tokens.len} tokens")
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
## Jinja2 template tokenizer for Validatrix.
|
||||
## Jinja2 template tokenizer for Nimcheck.
|
||||
##
|
||||
## Handles mixed Jinja2 template syntax ({{ }}, {% %}, {# #})
|
||||
## embedded inside HTML/text content.
|
||||
@@ -37,7 +37,7 @@ proc newJinjaTokenizer*(source: string, options: ValidationOptions = newValidati
|
||||
result.inBlockTag = false
|
||||
|
||||
method tokenize*(self: JinjaTokenizer) =
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugEnter("JINJA_TOKENIZER", "Starting Jinja tokenization")
|
||||
|
||||
@@ -118,6 +118,6 @@ method tokenize*(self: JinjaTokenizer) =
|
||||
self.emitToken(tkTemplateTag, text, startPos)
|
||||
|
||||
self.emitToken(tkEndOfFile, "", self.currentPos())
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugLeave("JINJA_TOKENIZER", &"Complete: {self.tokens.len} tokens")
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
## Nim language tokenizer for Validatrix.
|
||||
## Nim language tokenizer for Nimcheck.
|
||||
##
|
||||
## Tokenizes Nim source code following Nim's lexical rules including:
|
||||
## - Multi-line strings (""")
|
||||
@@ -65,7 +65,7 @@ proc newNimTokenizer*(source: string, options: ValidationOptions = newValidation
|
||||
|
||||
method tokenize*(self: NimTokenizer) =
|
||||
## Tokenize Nim source code.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugEnter("NIM_TOKENIZER", "Starting Nim tokenization")
|
||||
|
||||
@@ -341,6 +341,6 @@ method tokenize*(self: NimTokenizer) =
|
||||
# End of file
|
||||
self.emitToken(tkEndOfFile, "", self.currentPos())
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugLeave("NIM_TOKENIZER", &"Tokenization complete: {self.tokens.len} tokens")
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
## PHP tokenizer for Validatrix.
|
||||
## PHP tokenizer for Nimcheck.
|
||||
##
|
||||
## Handles mixed PHP/HTML content (template mode).
|
||||
|
||||
@@ -43,7 +43,7 @@ proc newPHPTokenizer*(source: string, options: ValidationOptions = newValidation
|
||||
result.inPhpMode = false
|
||||
|
||||
method tokenize*(self: PHPTokenizer) =
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugEnter("PHP_TOKENIZER", "Starting PHP tokenization")
|
||||
|
||||
@@ -221,6 +221,6 @@ method tokenize*(self: PHPTokenizer) =
|
||||
self.emitToken(tkError, $self.advance(), startPos)
|
||||
|
||||
self.emitToken(tkEndOfFile, "", self.currentPos())
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugLeave("PHP_TOKENIZER", &"Complete: {self.tokens.len} tokens (PHP mode: {self.inPhpMode})")
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
## Python tokenizer for Validatrix.
|
||||
## Python tokenizer for Nimcheck.
|
||||
##
|
||||
## Tokenizes Python source code including:
|
||||
## - Single/double quoted strings
|
||||
@@ -70,7 +70,7 @@ proc getIndentLevel*(line: string): int =
|
||||
|
||||
method tokenize*(self: PythonTokenizer) =
|
||||
## Tokenize Python source code.
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugEnter("PYTHON_TOKENIZER", "Starting Python tokenization")
|
||||
|
||||
@@ -349,6 +349,6 @@ method tokenize*(self: PythonTokenizer) =
|
||||
# End of file
|
||||
self.emitToken(tkEndOfFile, "", self.currentPos())
|
||||
|
||||
when defined(validatrixDebug):
|
||||
when defined(nimcheckDebug):
|
||||
if self.options.debugMode:
|
||||
debugLeave("PYTHON_TOKENIZER", &"Tokenization complete: {self.tokens.len} tokens")
|
||||
Reference in New Issue
Block a user