Showing 754 of 2,690 total issues
Function setValue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function setValue(device, deviceFeature, value) {
const externalId = deviceFeature.external_id;
const [prefix, topic, command] = deviceFeature.external_id.split(':');
if (prefix !== 'tasmota') {
- 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 newValueVibration
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function newValueVibration(message, data) {
const { sid } = message;
logger.debug(`Xiaomi : New value vibration, sid = ${sid}`);
const newSensor = {
service_id: this.serviceId,
- 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 getDeviceName
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const getDeviceName = (device) => {
const name =
device.name !== ''
? device.name
: titleize(
- 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 init
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function init() {
try {
// try to connect instance to Gladys Gateway
const gladysGatewayRefreshToken = await this.variable.getValue('GLADYS_GATEWAY_REFRESH_TOKEN');
const gladysGatewayRsaPrivateKey = await this.variable.getValue('GLADYS_GATEWAY_RSA_PRIVATE_KEY');
- 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 refreshingTokens
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function refreshingTokens() {
const { clientId, clientSecret } = this.configuration;
if (!clientId || !clientSecret) {
await this.saveStatus({ statusType: STATUS.NOT_INITIALIZED, message: null });
throw new ServiceNotConfiguredError('Netatmo is not configured.');
- 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 requestEventsData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function requestEventsData(xhr, calendarUrl, eventsToUpdate, calDavHost) {
const req = new this.dav.Request({
method: 'REPORT',
requestData: `
<c:calendar-multiget xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">
- 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 handleAlexaMessage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function handleAlexaMessage(data, rawMessage, cb) {
try {
const service = this.serviceManager.getService('alexa');
const body = {
...data.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
Function checkIfBackupNeeded
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function checkIfBackupNeeded() {
if (!this.connected) {
logger.info(`Instance not connected to Gladys Gateway, not backing up.`);
return;
}
- 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 handleGoogleHomeMessage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function handleGoogleHomeMessage(data, rawMessage, cb) {
const service = this.serviceManager.getService('google-actions');
try {
const body = {
...data.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
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 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 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 newValue;
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 null;
Avoid too many return
statements within this function. Open
return (
<ShutterButtons
value={this.props.action.value}
category={this.state.deviceFeature.category}
type={this.state.deviceFeature.type}
Avoid too many return
statements within this function. Open
return (
<div>
<div className={style.explanationText}>
<Text id="editScene.actionsCard.deviceSetValue.simpleExplanationText" />
</div>