Showing 54 of 203 total issues
Function component
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
component() {
const element = useElement();
const theme = useTheme();
useMemo(() => {
Function onclick
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
button.onclick = async () => {
if (isClickable) {
const actionCallList = [];
const { actions } = layout;
actions.forEach((action) => {
Function navigationCall
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
navigationCall: async ({ websiteUrl, sameWindow }) => {
try {
if (websiteUrl) {
const protocol = getCurrentProtocol(websiteUrl);
const url = removeProtocolHttp(websiteUrl);
- 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 oldAutomationRun
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const oldAutomationRun = async (automation, automationPostData, app) => {
try {
automation = encodeURIComponent(automation);
const itemInfo = await fetch(`../api/v1/items/${automation}`).then((response) => response.json());
const autoInfo = await fetch(`../api/v1/automations/${itemInfo.resourceId}`).then((response) => response.json());
- 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 validateFiles
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const validateFiles = (pkg) => {
const whitelist = [
"name",
"version",
"description",
Function createLabelAndIcon
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
createLabelAndIcon({ button, theme, style = {}, isSense }) {
const { icon = {}, font = {}, label = DEFAULTS.LABEL, showLabel = true } = style;
// text element wrapping label and icon
const text = document.createElement("text");
text.style.whiteSpace = "nowrap";
Function convertAction
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function convertAction(action, newProperties) {
const newAction = {
actionType: action.actionType,
bookmark: action.selectedBookmark,
// Will need to convert field selected by expression
Function parseOutput
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const parseOutput = (data, translator) => {
const defaultMessage = { message: getDefaultMessage(translator) };
if (typeof data !== "undefined") {
if (typeof data === "object") {
if (Array.isArray(data)) {
Function createLabelAndIcon
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
createLabelAndIcon({ button, theme, style = {}, isSense }) {
const { icon = {}, font = {}, label = DEFAULTS.LABEL, showLabel = true } = style;
// text element wrapping label and icon
const text = document.createElement("text");
text.style.whiteSpace = "nowrap";
- 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 ext
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function ext({ translator, shouldHide, senseNavigation, theme, isGoToChartEnabled }) {
const multiUserAutomation =
shouldHide.isEnabled && shouldHide.isEnabled("SENSECLIENT_IM_1855_AUTOMATIONS_MULTI_USER");
return {
definition: {
- 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 getFadedColor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
getFadedColor(color) {
const percent = 0.15;
let f;
let R;
let B;
Function getStyleEditorDefinition
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const getStyleEditorDefinition = ({ flags, theme, translator }) => {
const fontResolver = createFontResolver({
theme,
translator,
flags,
- 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 getAutomationProps
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const getAutomationProps = (multiUserAutomation, getAutomations) => ({
// adds automation to actions and adds a dropdown property panel
// item to select the automation for the button to trigger
// Boolean property to instruct the automation action to create a
- 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 setTextFontSize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const setTextFontSize = (text, font, textFontSize, hasIcon) => {
if (font.style && font.style.italic) {
if (hasIcon) {
text.style.fontSize = `${trimDecimal(Math.max(textFontSize * 0.84, 8))}px`;
text.children[0].style.marginRight = `${trimDecimal(text.offsetWidth * 0.04)}px`;
- 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 resolveExpression
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
resolveExpression: (input) => {
// rgb
let matches = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(input);
if (matches) {
return `rgb(${matches[1]},${matches[2]},${matches[3]})`;
- 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 getFadedColor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getFadedColor(color) {
const percent = 0.15;
let f;
let R;
let B;
- 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 { message: data };
Avoid too many return
statements within this function. Open
return defaultMessage;
Avoid too many return
statements within this function. Open
return resolve({ ...parseOutput(automationRun.title, translator), ok: true });
Avoid too many return
statements within this function. Open
return resolve({
message: getDefaultMessage(translator),
ok: true,
});