Skip to content

Commit acc0750

Browse files
author
WebFreak001
committed
add #19
1 parent 92f28d5 commit acc0750

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@
165165
{
166166
"command": "code-d.uploadSelection",
167167
"title": "code-d: Upload selection to dpaste.com"
168+
},
169+
{
170+
"command": "code-d.insertDscanner",
171+
"title": "code-d: Insert default dscanner.ini content"
168172
}
169173
],
170174
"jsonValidation": [

src/extension.ts

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,75 @@ export function activate(context: vscode.ExtensionContext) {
196196
vscode.window.showErrorMessage("Could not update imports. dub might not be initialized yet!");
197197
});
198198
}));
199+
200+
context.subscriptions.push(vscode.commands.registerCommand("code-d.insertDscanner", () => {
201+
vscode.window.activeTextEditor.edit((bld) => {
202+
bld.insert(vscode.window.activeTextEditor.selection.start, `; Configurue which static analysis checks are enabled
203+
[analysis.config.StaticAnalysisConfig]
204+
; Check variable, class, struct, interface, union, and function names against the Phobos style guide
205+
style_check="true"
206+
; Check for array literals that cause unnecessary allocation
207+
enum_array_literal_check="true"
208+
; Check for poor exception handling practices
209+
exception_check="true"
210+
; Check for use of the deprecated 'delete' keyword
211+
delete_check="true"
212+
; Check for use of the deprecated floating point operators
213+
float_operator_check="true"
214+
; Check number literals for readability
215+
number_style_check="true"
216+
; Checks that opEquals, opCmp, toHash, and toString are either const, immutable, or inout.
217+
object_const_check="true"
218+
; Checks for .. expressions where the left side is larger than the right.
219+
backwards_range_check="true"
220+
; Checks for if statements whose 'then' block is the same as the 'else' block
221+
if_else_same_check="true"
222+
; Checks for some problems with constructors
223+
constructor_check="true"
224+
; Checks for unused variables and function parameters
225+
unused_variable_check="true"
226+
; Checks for unused labels
227+
unused_label_check="true"
228+
; Checks for duplicate attributes
229+
duplicate_attribute="true"
230+
; Checks that opEquals and toHash are both defined or neither are defined
231+
opequals_tohash_check="true"
232+
; Checks for subtraction from .length properties
233+
length_subtraction_check="true"
234+
; Checks for methods or properties whose names conflict with built-in properties
235+
builtin_property_names_check="true"
236+
; Checks for confusing code in inline asm statements
237+
asm_style_check="true"
238+
; Checks for confusing logical operator precedence
239+
logical_precedence_check="true"
240+
; Checks for undocumented public declarations
241+
undocumented_declaration_check="true"
242+
; Checks for poor placement of function attributes
243+
function_attribute_check="true"
244+
; Checks for use of the comma operator
245+
comma_expression_check="true"
246+
; Checks for local imports that are too broad
247+
local_import_check="true"
248+
; Checks for variables that could be declared immutable
249+
could_be_immutable_check="true"
250+
; Checks for redundant expressions in if statements
251+
redundant_if_check="true"
252+
; Checks for redundant parenthesis
253+
redundant_parens_check="true"
254+
; Checks for mismatched argument and parameter names
255+
mismatched_args_check="true"
256+
; Checks for labels with the same name as variables
257+
label_var_same_name_check="true"
258+
; Checks for lines longer than 120 characters
259+
long_line_check="true"
260+
; Checks for assignment to auto-ref function parameters
261+
auto_ref_assignment_check="true"
262+
; Checks for incorrect infinite range definitions
263+
incorrect_infinite_range_check="true"
264+
; Checks for asserts that are always true
265+
useless_assert_check="true"`);
266+
});
267+
}));
199268

200269
console.log("Initialized code-d");
201270
}

0 commit comments

Comments
 (0)