Showing 38 of 52 total issues
Function save
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function save() {
// create dir for data if it does not exists
$counter = 0;
while (true) {
$this->set('id', $this->generateNewId());
- 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 bestOptions
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
@computed('users.[]')
get bestOptions() {
// can not evaluate answer type free text
if (this.get('poll.isFreeText')) {
return undefined;
Function normalize
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
normalize(payload) {
let [type] = Object.keys(payload);
let attrs = payload[type];
let { belongsToAssociations, hasManyAssociations } = this.registry.schema._registry[type].class.prototype;
Function adoptTimesOfFirstDay
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
@action
adoptTimesOfFirstDay() {
const dates = this.dates;
const datesForFirstDay = this.datesForFirstDay;
const timesForFirstDay = this.timesForFirstDay;
Function data
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
@computed('users.[]', 'options.{[],each.title}', 'currentLocale')
get data() {
let labels = this.options.map((option) => {
let value = get(option, 'title');
if (!this.isFindADate) {
Method restore
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function restore($id) {
if (!static::isValidId($id)) {
throw new Exception($id . ' is not a valid id');
}
Function evaluation
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
@computed('users.[]')
get evaluation() {
if (!this.isEvaluable) {
return [];
}
Function exports
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(defaults) {
let app = new EmberApp(defaults, {
autoImport: {
forbidEval: true,
webpack: {
Function default
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function(answerType) {
switch (answerType) {
case 'YesNo':
return [
{
Method save
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function save() {
// create dir for data if it does not exists
$counter = 0;
while (true) {
$this->set('id', $this->generateNewId());
Function postBuild
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
postBuild(result) {
let environment = this.app.env;
// do not include app if build is for testing purposes only
if (environment === 'test') {
Function chartOptions
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
@computed
get chartOptions() {
return {
legend: {
display: false
Function restore
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function restore($id) {
if (!static::isValidId($id)) {
throw new Exception($id . ' is not a valid id');
}
- 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 isValidSJCL
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function isValidSJCL($jsonstring) {
$accepted_keys=array('iv','v','iter','ks','ts','mode','adata','cipher','salt','ct');
// Make sure content is valid json
$decoded = json_decode($jsonstring);
- 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 validate
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
validate(value, options, model, attribute) {
assert(
'options.parent is required',
isPresent(options.parent)
);
Function submit
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
async submit() {
if (!this.get('validations.isValid')) {
return;
}
Function selections
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
selections: computed('options', 'pollController.dates', function() {
let options = this.options;
let isFindADate = this.isFindADate;
let lastDate;
Function submit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
@action
async submit() {
if (!this.validations.isValid) {
return;
}
Function restoreLegacySupportHook
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function restoreLegacySupportHook(&$data) {
if (!isset($data->version) || $data->version === 'v0.3-0') {
if (isset($data->user) && is_object($data->user)) {
$data = $data->user;
}
- 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 deleteDirRecursively
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function deleteDirRecursively($dir) {
if (substr($dir, -1) !== '/') {
throw new Exception('dir has to end on /');
}
- 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"