Showing 737 of 2,655 total issues
Function getCaldavSetting
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getCaldavSetting(state) {
store.setState({
caldavGetSettingsStatus: CalDAVStatus.Getting
});
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(props, {}) {
return (
<BaseEditBox {...props} titleKey="dashboard.boxTitle.clock">
<div className="form-group">
<label>
Function up
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
up: async (queryInterface, Sequelize) => {
const service = await db.Service.findOne({
where: {
name: 'enedis',
},
Function cancelLearn
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function cancelLearn(peripheralIdentifier) {
logger.debug(`Broalink leaving learn mode with ${peripheralIdentifier}`);
clearTimeout(this.learnTimers[peripheralIdentifier]);
Function connect
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function connect() {
this.configured = false;
this.connected = false;
const email = await this.gladys.variable.getValue(EWELINK_EMAIL_KEY, this.serviceId);
Function get
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function get(options) {
const optionsWithDefault = { ...DEFAULT_OPTIONS, ...options };
const include = [];
if (optionsWithDefault.expand.includes('devices')) {
include.push({
Function init
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function init(startDeviceStateAggregate = true) {
// load all devices in RAM
const devices = await db.Device.findAll({
include: [
{
Function deleteHouse
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async deleteHouse(state, houseIndex) {
store.setState({
houseUpdateStatus: RequestStatus.Getting
});
const house = state.houses[houseIndex];
Function createActions
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createActions(store) {
const actions = {
async getUsers(state) {
store.setState({
usersGetStatus: RequestStatus.Getting
Function sendToUser
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function sendToUser(userSelector, text, file = null) {
const user = this.state.get('user', userSelector);
if (user === null) {
throw new NotFoundError(`User ${userSelector} not found`);
}
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(props, {}) {
return (
<SettingsLayout currentUrl={props.currentUrl}>
{props.newUser && (
<CreateUserPage
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(props, { loading, tooMuchStatesError, statesNumber }) {
return (
<div class="col-md-6">
<div class="card">
<div class="card-header">{props.device.name || <Text id="integration.mqtt.device.noNameLabel" />}</div>
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(
props,
{
dashboards,
currentDashboard,
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(props, {}) {
let messageKey;
let linkUrl = '';
let linkText = '';
if (!props.usbConfigured) {
Function updateFeatureProperty
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateFeatureProperty(e, property, featureIndex) {
let value = e.target.value;
let device;
if (property === 'external_id' && !value.startsWith('mqtt:')) {
if (value.length < 5) {
Function onExecute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function onExecute(body) {
const directiveNamespace = get(body, 'directive.header.namespace');
const directiveName = get(body, 'directive.header.name');
const endpointId = get(body, 'directive.endpoint.endpointId');
const correlationToken = get(body, 'directive.header.correlationToken');
- 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 handleGladysMessage
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function handleGladysMessage(topic, message) {
const parsedTopic = topic.split('/');
if (topic === 'gladys/master/device/create') {
this.gladys.event.emit(EVENTS.DEVICE.NEW, JSON.parse(message));
} else if (topic.startsWith('gladys/master/device/')) {
- 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 throwErrorIfNeeded
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async function throwErrorIfNeeded(response, emit = false, config = false) {
if (response.error) {
if (response.error === 406) {
this.connected = false;
this.accessToken = '';
- 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 getEvents
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async function getEvents(userId, options) {
const where = {};
if (options.from || options.to) {
const oneWeekAgo = new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000);
- 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 command
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async function command(message, classification, context) {
let humidityResult;
const roomEntity = classification.entities.find((entity) => entity.entity === 'room');
try {
switch (classification.intent) {
- 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"