Showing 742 of 2,674 total issues
Function componentWillMount
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async componentWillMount() {
let { deviceSelector, peripheral } = this.props;
let device;
let loading = RequestStatus.Success;
let isRemote;
- 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 SessionDeviceLabel
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const SessionDeviceLabel = ({ session }) => {
let label;
let icon;
if (!session.useragent) {
- 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 render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
render(
props,
{
isGladysPlus,
dashboardDropdownOpened,
- 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 actions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const actions = store => ({
updateCalendarSharing(state, e) {
store.setState({
calendarsSharing: {
...state.calendarsSharing,
- 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 saveDevice
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async saveDevice() {
this.setState({
loading: true
});
try {
- 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 Header
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const Header = ({ ...props }) => {
if (isUrlInArray(props.currentUrl, PAGES_WITHOUT_HEADER)) {
return null;
}
// Adapt forum URL to user language
- 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 null;
Avoid too many return
statements within this function. Open
return Math.round((payload.brightness * max) / 100);
Avoid too many return
statements within this function. Open
return newValue;
Avoid too many return
statements within this function. Open
return Math.round(((lastValue - firstValue) / Math.abs(firstValue)) * 100);
Avoid too many return
statements within this function. Open
return (
<div>
<div className={style.explanationText}>
<Text id="editScene.actionsCard.deviceSetValue.simpleExplanationText" />
</div>
Avoid too many return
statements within this function. Open
return 'danger';
Avoid too many return
statements within this function. Open
return 'purple';
Function recursiveSearch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const recursiveSearch = (message, callback, key = undefined) => {
Object.keys(message).forEach((subKey) => {
const currentObj = message[subKey];
const fullKey = `${key ? `${key}.` : ''}${subKey}`;
- 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 exports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (sequelize, DataTypes) => {
const User = sequelize.define(
't_user',
{
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 scan
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function scan(options) {
const { singleAddress, firstAddress, lastAddress, username, password } = options;
if (singleAddress) {
logger.debug(`Tasmota: HTTP looking for ${singleAddress}`);
this.status(singleAddress, username, password);
- 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 RoomController
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function RoomController(gladys) {
/**
* @api {post} /api/v1/house/:house_selector/room create
* @apiName create
* @apiGroup Room
- 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 updateValues
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async function updateValues(deviceGladys, deviceNetatmo, externalId) {
const [prefix, topic] = externalId.split(':');
const { reachable } = deviceNetatmo;
if (prefix !== 'netatmo') {
throw new BadParameters(`Netatmo device external_id is invalid: "${externalId}" should starts with "netatmo:"`);
- 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 forwardDeviceStateToAlexa
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async function forwardDeviceStateToAlexa(event) {
if (!this.connected) {
logger.debug('Gateway: not connected. Prevent forwarding device new state.');
return null;
}
- 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 loadDeviceDetails
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async function loadDeviceDetails(homeData) {
const { rooms: roomsHomeData, modules: modulesHomeData, id: homeId } = homeData;
let listDevices = [];
logger.debug('loading devices details in home id: ', homeId, '...');
- 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"