Showing 71 of 183 total issues
Function save
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async save() {
this.state.disabled = true;
this.state.isSaving = true;
if (!this.isEditing.value) {
Function directive
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const directive = ($window) => {
return {
templateUrl: "components/editointikontrollit/editointikontrollit.jade",
restrict: "E",
controller: controller,
Function createListRestangular
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const createListRestangular = (
scope,
field: string,
resolvedObj: Restangular.IElement) => {
scope[field] = resolvedObj.clone();
Function doDiff
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const doDiff = (oldVersion?, newVersion?) => {
oldVersion = oldVersion || $scope.currentHistoryItem;
newVersion = newVersion || $scope.data;
if (!oldVersion || !oldVersion[$scope.selectedLang]) {
Function install
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static install(vue: typeof Vue, config: OikeustarkasteluConfig) {
vue.prototype.$isAdmin = () => config.oikeusProvider.isAdmin?.value || false;
vue.prototype.$hasOphCrud = () => config.oikeusProvider.hasOphCrud?.value || false;
vue.prototype.$hasOikeus = function(oikeus: Oikeus, kohde?: any) {
Function FooterData
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const FooterData = function ($http, $window, $q) {
let data = null;
let fetched = false;
const pattern = /([^=]+)=([^=]+)(?:\n|$)/gi;
this.fetch = function() {
Function rakenneNodecolor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function rakenneNodecolor(node, parentMandatory, el) {
const isRyhma = !!node.rooli;
if (isRyhma) {
const mapped = RooliToTheme[node.rooli];
Function yleissivastavatKoulutustyyppiRelaatiot
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function yleissivastavatKoulutustyyppiRelaatiot() {
return [{
koulutustyyppi: 'koulutustyyppi_20',
alityypit: ['koulutustyyppi_20'],
}, {
Function link
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: (scope, element, attrs, ngModel) => {
let parsedMoment;
ngModel.$parsers.unshift(function (viewValue) {
return validate(viewValue);
});
Function getVersion
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getVersion = (modelValue?): Promise<any> => new Promise((resolve, reject) => {
if (!_.isNumber(modelValue)) {
modelValue = $scope.historySlider.value;
}
Function uusiViesti
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const uusiViesti = (tyyppi, viesti, ilmanKuvaa?) => {
if (_.isObject(viesti) && viesti.data && viesti.data.syy) {
viesti = viesti.data.syy;
}
else if (!viesti) {
- 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 translate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const translate = (obj, key, useFallback) => {
const getTranslation = (input, lang) => {
return input[lang] || input[lang.toUpperCase()] || input["kieli_" + lang + "#1"];
};
- 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 update
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public async update() {
if (this.state.perusteId) {
if (this.state.muokkaustiedot && !_.isEmpty(this.state.muokkaustiedot)) {
this.state.viimeinenHaku = (await Muokkaustiedot.getPerusteenMuokkausTiedotWithLuomisaika(this.state.perusteId, (_.last(this.state.muokkaustiedot) as any).luotu, this.state.hakuLukumaara) as any).data;
- 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
Avoid deeply nested control flow statements. Open
if (id && !(id in cache)) {
cache[id] = true;
stack.push(head[key]);
}
Function muokkaustietoRoute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function muokkaustietoRoute(id, kohde, tapahtuma, tyyppi = 'ops', lisaparametrit?) {
Function start
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public async start() {
this.state.disabled = true;
this.state.isLoading = true;
// Ei editointia uudestaan
- 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 save
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public async save() {
this.state.disabled = true;
this.state.isSaving = true;
if (!this.isEditing.value) {
- 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 setUiKieli
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const setUiKieli = (kielikoodi, doStateChange?) => {
if (isValidKielikoodi(kielikoodi) &&
(kielikoodi !== uikieli || (stateInited && _$stateParams.lang !== kielikoodi))) {
if (_.isUndefined(doStateChange) || doStateChange === true) {
_$state.go(_$state.current.name, _.merge(_$stateParams, {lang: kielikoodi}), {reload: true});
- 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
Avoid too many return
statements within this function. Open
return [koulutustyyppi];
Avoid too many return
statements within this function. Open
return ColorMap.pakollinen;