Showing 1,049 of 1,049 total issues
Function searchConcepts
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function searchConcepts($params)
{
// don't even try to search for empty prefix if no other search criteria (group or parent concept) has been set
if (($params->getSearchTerm() === "" || !preg_match('/[^*]/', $params->getSearchTerm())) && !$params->getGroupLimit() && !$params->getParentLimit()) {
return array();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getCrumbs
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private function getCrumbs($bTresult, $uri, $path = null)
{
$crumbs = array();
if (!isset($path)) {
$path = array();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function startTermCountsApp
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
function startTermCountsApp () {
const termCountsApp = Vue.createApp({
data () {
return {
languages: []
Method transformConceptSearchResult
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function transformConceptSearchResult($row, $vocabs, $fields)
{
$hit = array();
$hit['uri'] = $row->s->getUri();
Method invokeVocabularySearch
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function invokeVocabularySearch($request)
{
$template = $this->twig->load('vocab-search.twig');
$this->model->setLocale($request->getLang());
$vocab = $request->getVocab();
Method transformParentListResults
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function transformParentListResults($result, $lang)
{
$ret = array();
foreach ($result as $row) {
if (!isset($row->broad)) {
Method hierarchy
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function hierarchy($request)
{
if ($this->notModified($request->getVocab())) {
return null;
}
Similar blocks of code found in 3 locations. Consider refactoring. Open
public function related($request)
{
if ($this->notModified($request->getVocab())) {
return null;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 127.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
public function broader($request)
{
if ($this->notModified($request->getVocab())) {
return null;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 127.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
public function narrower($request)
{
if ($this->notModified($request->getVocab())) {
return null;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 127.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function transformConceptGroupContentsResults
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function transformConceptGroupContentsResults($result, $lang)
{
$ret = array();
$values = array();
foreach ($result as $row) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getDataURLs
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function getDataURLs()
{
$ret = array();
$urls = $this->resource->allResources("void:dataDump");
foreach ($urls as $url) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method findLookupHits
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function findLookupHits($results, $label, $lang)
{
$hits = array();
// case 1: exact match on preferred label
foreach ($results as $res) {
Method invokeGlobalSearch
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function invokeGlobalSearch($request)
{
$lang = $request->getLang();
$template = $this->twig->load('global-search.twig');
$this->model->setLocale($request->getLang());
Function generateConceptSearchQuery
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function generateConceptSearchQuery($fields, $unique, $params, $showDeprecated = false)
{
$vocabs = $params->getVocabs();
$gcl = $this->graphClause;
$fcl = empty($vocabs) ? '' : $this->generateFromClause($vocabs);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function transformChangeListResults
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function transformChangeListResults($result)
{
$ret = array();
foreach ($result as $row) {
$concept = array('uri' => $row->concept->getURI());
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function filterPlugins
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function filterPlugins($type, $raw = false)
{
$plugins = $this->getPlugins();
$plugins = $this->sortPlugins($plugins);
$ret = array();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function loadConceptHierarchy
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadConceptHierarchy () {
this.loadingHierarchy = true
fetch('rest/v1/' + window.SKOSMOS.vocab + '/hierarchy/?uri=' + window.SKOSMOS.uri + '&lang=' + window.SKOSMOS.content_lang)
.then(data => {
return data.json()
Function removeDuplicatePropertyValues
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function removeDuplicatePropertyValues($ret, $duplicates)
{
$propertyValues = array();
foreach ($ret as $prop) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method generateAlphabeticalListQuery
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateAlphabeticalListQuery($letter, $lang, $limit = null, $offset = null, $classes = null, $showDeprecated = false, $qualifier = null)
{
if ($letter == '*' || $letter == '0-9' || $letter == '!*') {
// text index cannot support special character queries, use the generic implementation for these
return parent::generateAlphabeticalListQuery($letter, $lang, $limit, $offset, $classes, $showDeprecated, $qualifier);