Skip to content

Commit f894e3d

Browse files
authored
fix: fetch all pages of default patterns (#137)
* fix: fetch all pages of default patterns * update tests expected config files
1 parent aa560d8 commit f894e3d

File tree

7 files changed

+31392
-6
lines changed

7 files changed

+31392
-6
lines changed

codacy-client/client.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,14 @@ func parseDefaultPatternConfigurations(response []byte) ([]domain.PatternConfigu
128128
}
129129
}
130130

131-
return patternConfigurations, "", nil
131+
var pagination domain.Pagination
132+
if objmap["pagination"] != nil {
133+
if err := json.Unmarshal(objmap["pagination"], &pagination); err != nil {
134+
return nil, "", fmt.Errorf("failed to unmarshal pagination: %w", err)
135+
}
136+
}
137+
138+
return patternConfigurations, pagination.Cursor, nil
132139
}
133140

134141
// parsePatternConfigurations parses the response body into pattern configurations

integration-tests/init-without-token/expected/.gitignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

integration-tests/init-without-token/expected/tools-configs/analysis_options.yaml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ analyzer:
2727
no_adjacent_strings_in_list: error
2828
no_duplicate_case_values: error
2929
no_logic_in_create_state: error
30+
package_names: info
31+
prefer_relative_imports: error
32+
prefer_void_to_null: error
33+
secure_pubspec_urls: info
34+
sort_pub_dependencies: info
35+
test_types_in_equals: error
36+
throw_in_finally: error
37+
unnecessary_statements: error
38+
unrelated_type_equality_checks: error
39+
unsafe_html: error
40+
use_build_context_synchronously: error
41+
use_key_in_widget_constructors: error
42+
valid_regexps: error
3043
linter:
3144
rules:
3245
always_declare_return_types: "true"
@@ -102,3 +115,108 @@ linter:
102115
no_leading_underscores_for_local_identifiers: "true"
103116
no_runtimeType_toString: "true"
104117
non_constant_identifier_names: "true"
118+
noop_primitive_operations: "true"
119+
null_check_on_nullable_type_parameter: "true"
120+
null_closures: "true"
121+
omit_local_variable_types: "true"
122+
one_member_abstracts: "true"
123+
only_throw_errors: "true"
124+
overridden_fields: "true"
125+
package_api_docs: "true"
126+
package_prefixed_library_names: "true"
127+
parameter_assignments: "true"
128+
prefer_adjacent_string_concatenation: "true"
129+
prefer_asserts_in_initializer_lists: "true"
130+
prefer_asserts_with_message: "true"
131+
prefer_bool_in_asserts: "true"
132+
prefer_collection_literals: "true"
133+
prefer_conditional_assignment: "true"
134+
prefer_const_constructors: "true"
135+
prefer_const_constructors_in_immutables: "true"
136+
prefer_const_declarations: "true"
137+
prefer_const_literals_to_create_immutables: "true"
138+
prefer_constructors_over_static_methods: "true"
139+
prefer_contains: "true"
140+
prefer_double_quotes: "true"
141+
prefer_equal_for_default_values: "true"
142+
prefer_expression_function_bodies: "true"
143+
prefer_final_fields: "true"
144+
prefer_final_in_for_each: "true"
145+
prefer_final_locals: "true"
146+
prefer_final_parameters: "true"
147+
prefer_for_elements_to_map_fromIterable: "true"
148+
prefer_foreach: "true"
149+
prefer_function_declarations_over_variables: "true"
150+
prefer_generic_function_type_aliases: "true"
151+
prefer_if_elements_to_conditional_expressions: "true"
152+
prefer_if_null_operators: "true"
153+
prefer_initializing_formals: "true"
154+
prefer_inlined_adds: "true"
155+
prefer_int_literals: "true"
156+
prefer_interpolation_to_compose_strings: "true"
157+
prefer_is_empty: "true"
158+
prefer_is_not_empty: "true"
159+
prefer_is_not_operator: "true"
160+
prefer_iterable_whereType: "true"
161+
prefer_mixin: "true"
162+
prefer_null_aware_method_calls: "true"
163+
prefer_null_aware_operators: "true"
164+
prefer_single_quotes: "true"
165+
prefer_spread_collections: "true"
166+
prefer_typing_uninitialized_variables: "true"
167+
provide_deprecation_message: "true"
168+
public_member_api_docs: "true"
169+
recursive_getters: "true"
170+
require_trailing_commas: "true"
171+
sized_box_for_whitespace: "true"
172+
sized_box_shrink_expand: "true"
173+
slash_for_doc_comments: "true"
174+
sort_child_properties_last: "true"
175+
sort_constructors_first: "true"
176+
sort_unnamed_constructors_first: "true"
177+
super_goes_last: "true"
178+
tighten_type_of_initializing_formals: "true"
179+
type_annotate_public_apis: "true"
180+
type_init_formals: "true"
181+
unawaited_futures: "true"
182+
unnecessary_await_in_return: "true"
183+
unnecessary_brace_in_string_interps: "true"
184+
unnecessary_const: "true"
185+
unnecessary_constructor_name: "true"
186+
unnecessary_final: "true"
187+
unnecessary_getters_setters: "true"
188+
unnecessary_lambdas: "true"
189+
unnecessary_late: "true"
190+
unnecessary_library_directive: "true"
191+
unnecessary_new: "true"
192+
unnecessary_null_aware_assignments: "true"
193+
unnecessary_null_aware_operator_on_extension_on_nullable: "true"
194+
unnecessary_null_checks: "true"
195+
unnecessary_null_in_if_null_operators: "true"
196+
unnecessary_nullable_for_final_variable_declarations: "true"
197+
unnecessary_overrides: "true"
198+
unnecessary_parenthesis: "true"
199+
unnecessary_raw_strings: "true"
200+
unnecessary_string_escapes: "true"
201+
unnecessary_string_interpolations: "true"
202+
unnecessary_this: "true"
203+
unnecessary_to_list_in_spreads: "true"
204+
unreachable_from_main: "true"
205+
use_colored_box: "true"
206+
use_decorated_box: "true"
207+
use_enums: "true"
208+
use_full_hex_values_for_flutter_colors: "true"
209+
use_function_type_syntax_for_parameters: "true"
210+
use_if_null_to_convert_nulls_to_bools: "true"
211+
use_is_even_rather_than_modulo: "true"
212+
use_late_for_private_fields_and_variables: "true"
213+
use_named_constants: "true"
214+
use_raw_strings: "true"
215+
use_rethrow_when_possible: "true"
216+
use_setters_to_change_properties: "true"
217+
use_string_buffers: "true"
218+
use_string_in_part_of_directives: "true"
219+
use_super_parameters: "true"
220+
use_test_throws_matchers: "true"
221+
use_to_and_as_if_applicable: "true"
222+
void_checks: "true"

integration-tests/init-without-token/expected/tools-configs/eslint.config.mjs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,55 @@ export default [
1313
"no-constant-condition": ["error", {"checkLoops": true}],
1414
"no-control-regex": ["error"],
1515
"no-debugger": ["error"],
16+
"no-delete-var": ["error"],
17+
"no-dupe-args": ["error"],
18+
"no-dupe-class-members": ["error"],
19+
"no-dupe-else-if": ["error"],
20+
"no-dupe-keys": ["error"],
21+
"no-duplicate-case": ["error"],
22+
"no-empty": ["error", {"allowEmptyCatch": false}],
23+
"no-empty-character-class": ["error"],
24+
"no-empty-pattern": ["error", {"allowObjectPatternsAsParameters": false}],
25+
"no-ex-assign": ["error"],
26+
"no-extra-boolean-cast": ["error", {"enforceForLogicalOperands": false}],
27+
"no-extra-semi": ["error"],
28+
"no-fallthrough": ["error", {"allowEmptyCase": false}],
29+
"no-func-assign": ["error"],
30+
"no-global-assign": ["error"],
31+
"no-import-assign": ["error"],
32+
"no-inner-declarations": ["error", "functions"],
33+
"no-invalid-regexp": ["error"],
34+
"no-irregular-whitespace": ["error", {"skipStrings": true, "skipJSXText": false, "skipRegExps": false, "skipComments": false, "skipTemplates": false}],
35+
"no-loss-of-precision": ["error"],
36+
"no-misleading-character-class": ["error"],
37+
"no-mixed-spaces-and-tabs": ["error"],
38+
"no-new-symbol": ["error"],
39+
"no-nonoctal-decimal-escape": ["error"],
40+
"no-obj-calls": ["error"],
41+
"no-octal": ["error"],
42+
"no-prototype-builtins": ["error"],
43+
"no-redeclare": ["error", {"builtinGlobals": true}],
44+
"no-regex-spaces": ["error"],
45+
"no-self-assign": ["error", {"props": true}],
46+
"no-setter-return": ["error"],
47+
"no-shadow-restricted-names": ["error"],
48+
"no-sparse-arrays": ["error"],
49+
"no-this-before-super": ["error"],
50+
"no-undef": ["error", {"typeof": false}],
51+
"no-unexpected-multiline": ["error"],
52+
"no-unreachable": ["error"],
53+
"no-unsafe-finally": ["error"],
54+
"no-unsafe-negation": ["error", {"enforceForOrderingRelations": false}],
55+
"no-unsafe-optional-chaining": ["error", {"disallowArithmeticOperators": false}],
56+
"no-unused-labels": ["error"],
57+
"no-unused-vars": ["error"],
58+
"no-useless-backreference": ["error"],
59+
"no-useless-catch": ["error"],
60+
"no-useless-escape": ["error"],
61+
"no-with": ["error"],
62+
"require-yield": ["error"],
63+
"use-isnan": ["error", {"enforceForSwitchCase": true, "enforceForIndexOf": false}],
64+
"valid-typeof": ["error", {"requireStringLiterals": false}],
1665
}
1766
}
1867
];
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
tools:
2+
- name: pylint
3+
languages: [Python]
4+
extensions: [.py]
5+
- name: eslint
6+
languages: [JavaScript, TypeScript, JSX, TSX]
7+
extensions: [.js, .jsx, .ts, .tsx]
8+
- name: pmd
9+
languages: [Java, JavaScript, JSP, Velocity, XML, Apex, Scala, Ruby, VisualForce]
10+
extensions: [.java, .js, .jsp, .vm, .xml, .cls, .trigger, .scala, .rb, .page, .component]
11+
- name: trivy
12+
languages: [Multiple]
13+
extensions: []
14+
- name: dartanalyzer
15+
languages: [Dart]
16+
extensions: [.dart]
17+
- name: lizard
18+
languages: [C, CPP, Java, "C#", JavaScript, TypeScript, VueJS, "Objective-C", Swift, Python, Ruby, "TTCN-3", PHP, Scala, GDScript, Golang, Lua, Rust, Fortran, Kotlin, Solidity, Erlang, Zig, Perl]
19+
extensions: [.c, .cpp, .cc, .h, .hpp, .java, .cs, .js, .jsx, .ts, .tsx, .vue, .m, .swift, .py, .rb, .ttcn, .php, .scala, .gd, .go, .lua, .rs, .f, .f90, .kt, .sol, .erl, .zig, .pl]
20+
- name: semgrep
21+
languages: [C, CPP, "C#", Generic, Go, Java, JavaScript, JSON, Kotlin, Python, TypeScript, Ruby, Rust, JSX, PHP, Scala, Swift, Terraform]
22+
extensions: [.c, .cpp, .h, .hpp, .cs, .go, .java, .js, .json, .kt, .py, .ts, .rb, .rs, .jsx, .php, .scala, .swift, .tf, .tfvars]
23+
- name: codacy-enigma-cli
24+
languages: [Multiple]
25+
extensions: []

integration-tests/init-without-token/expected/tools-configs/ruleset.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,43 @@
145145
<rule ref="category/plsql/design.xml/ExcessiveMethodLength"/>
146146
<rule ref="category/plsql/design.xml/ExcessiveObjectLength"/>
147147
<rule ref="category/plsql/design.xml/ExcessivePackageBodyLength"/>
148+
<rule ref="category/plsql/design.xml/ExcessivePackageSpecificationLength"/>
149+
<rule ref="category/plsql/design.xml/ExcessiveParameterList"/>
150+
<rule ref="category/plsql/design.xml/ExcessiveTypeLength"/>
151+
<rule ref="category/plsql/design.xml/TooManyMethods">
152+
<properties>
153+
<property name="maxmethods" value="1"/>
154+
</properties>
155+
</rule>
156+
<rule ref="category/plsql/errorprone.xml/TO_DATEWithoutDateFormat"/>
157+
<rule ref="category/plsql/errorprone.xml/TO_DATE_TO_CHAR"/>
158+
<rule ref="category/plsql/errorprone.xml/TO_TIMESTAMPWithoutDateFormat"/>
159+
<rule ref="category/pom/errorprone.xml/InvalidDependencyTypes">
160+
<properties>
161+
<property name="validTypes" value="pom,jar,maven-plugin,ejb,war,ear,rar,par"/>
162+
</properties>
163+
</rule>
164+
<rule ref="category/pom/errorprone.xml/ProjectVersionAsDependencyVersion"/>
165+
<rule ref="category/vf/security.xml/VfCsrf"/>
166+
<rule ref="category/vf/security.xml/VfUnescapeEl"/>
167+
<rule ref="category/vm/bestpractices.xml/AvoidReassigningParameters"/>
168+
<rule ref="category/vm/bestpractices.xml/UnusedMacroParameter"/>
169+
<rule ref="category/vm/design.xml/AvoidDeeplyNestedIfStmts"/>
170+
<rule ref="category/vm/design.xml/CollapsibleIfStatements"/>
171+
<rule ref="category/vm/design.xml/ExcessiveTemplateLength">
172+
<properties>
173+
<property name="minimum" value="1000"/>
174+
</properties>
175+
</rule>
176+
<rule ref="category/vm/design.xml/NoInlineJavaScript"/>
177+
<rule ref="category/vm/design.xml/NoInlineStyles"/>
178+
<rule ref="category/vm/errorprone.xml/EmptyForeachStmt"/>
179+
<rule ref="category/vm/errorprone.xml/EmptyIfStmt"/>
180+
<rule ref="category/xml/errorprone.xml/MistypedCDATASection"/>
181+
<rule ref="category/xsl/codestyle.xml/UseConcatOnce"/>
182+
<rule ref="category/xsl/performance.xml/AvoidAxisNavigation">
183+
<properties>
184+
<property name="checkSelfDescendantAbreviation" value="false"/>
185+
</properties>
186+
</rule>
148187
</ruleset>

0 commit comments

Comments
 (0)