🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@dannote/sloplint

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dannote/sloplint - npm Package Compare versions

Comparing version
0.1.1
to
0.2.0
+29
-3
dist/cli.js

@@ -15,3 +15,4 @@ #!/usr/bin/env node

import java from "@ast-grep/lang-java";
registerDynamicLanguage({ python, go, rust, c, cpp, java });
import ruby from "@ast-grep/lang-ruby";
registerDynamicLanguage({ python, go, rust, c, cpp, java, ruby });
var LANGUAGES = {

@@ -65,2 +66,8 @@ typescript: {

toolDirectives: /checkstyle|SuppressWarnings|PMD|SpotBugs|NOSONAR|noinspection/i
},
ruby: {
lang: "ruby",
commentKinds: ["comment"],
extensions: ["rb", "rake"],
toolDirectives: /rubocop|sorbet|sig|steep|yard|:nocov:|frozen_string_literal/i
}

@@ -296,2 +303,19 @@ };

};
var emptyRescueRuby = {
id: "empty-error-handler",
message: "Empty rescue block silently swallows errors",
note: "At minimum, log the error or add a comment explaining why it's safe to ignore.",
languages: ["ruby"],
check(node, _lang) {
if (node.kind() !== "rescue")
return null;
const then = node.children().find((c2) => c2.kind() === "then");
if (!then)
return this;
const stmts = then.children().filter((c2) => c2.isNamed());
if (stmts.length === 0)
return this;
return null;
}
};
var errorHandlingRules = [

@@ -302,3 +326,4 @@ emptyCatchTS,

passInExceptPython,
consoleLogInCatchTS
consoleLogInCatchTS,
emptyRescueRuby
];

@@ -318,3 +343,4 @@

java: ["catch_clause"],
python: ["except_clause"]
python: ["except_clause"],
ruby: ["rescue"]
};

@@ -321,0 +347,0 @@ function scanSource(source, lang, filename) {

+10
-8
{
"name": "@dannote/sloplint",
"version": "0.1.1",
"version": "0.2.0",
"description": "AST-based multilingual AI slop linter — catches obvious comments, narrator comments, step comments, section dividers, empty catch blocks, and more across 8 languages",

@@ -23,3 +23,3 @@ "license": "MIT",

"scripts": {
"build": "bun build src/cli.ts --outdir dist --target node --format esm --external @ast-grep/napi --external @ast-grep/lang-python --external @ast-grep/lang-go --external @ast-grep/lang-rust --external @ast-grep/lang-c --external @ast-grep/lang-cpp --external @ast-grep/lang-java",
"build": "bun build src/cli.ts --outdir dist --target node --format esm --external @ast-grep/napi --external @ast-grep/lang-python --external @ast-grep/lang-go --external @ast-grep/lang-rust --external @ast-grep/lang-c --external @ast-grep/lang-cpp --external @ast-grep/lang-java --external @ast-grep/lang-ruby",
"lint": "bun run src/cli.ts",

@@ -42,9 +42,10 @@ "test": "bun test",

"dependencies": {
"@ast-grep/napi": "^0.36.0",
"@ast-grep/lang-c": "^0.0.5",
"@ast-grep/lang-cpp": "^0.0.5",
"@ast-grep/lang-go": "^0.0.5",
"@ast-grep/lang-java": "^0.0.6",
"@ast-grep/lang-python": "^0.0.5",
"@ast-grep/lang-go": "^0.0.5",
"@ast-grep/lang-ruby": "0.0.6",
"@ast-grep/lang-rust": "^0.0.6",
"@ast-grep/lang-c": "^0.0.5",
"@ast-grep/lang-cpp": "^0.0.5",
"@ast-grep/lang-java": "^0.0.6"
"@ast-grep/napi": "0.40.5"
},

@@ -60,3 +61,4 @@ "devDependencies": {

"@ast-grep/lang-cpp",
"@ast-grep/lang-java"
"@ast-grep/lang-java",
"@ast-grep/lang-ruby"
],

@@ -63,0 +65,0 @@ "engines": {

@@ -25,3 +25,3 @@ # sloplint

|------|----------|---------|
| `empty-error-handler` | TS/JS/Java/Python | `catch (e) {}` or bare `except:` |
| `empty-error-handler` | TS/JS/Java/Python/Ruby | `catch (e) {}`, bare `except:`, empty `rescue` |
| `silent-exception` | Python | `except Exception: pass` |

@@ -32,3 +32,3 @@ | `log-in-error-handler` | TS/JS | `console.log` inside catch |

TypeScript, JavaScript, Python, Go, Rust, C, C++, Java
TypeScript, JavaScript, Python, Go, Rust, C, C++, Java, Ruby

@@ -35,0 +35,0 @@ ## Usage