Showing 2,655 of 2,655 total issues
Function connect
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function connect(configuration) {
const { baseUrl, accessKey, secretKey } = configuration;
if (!baseUrl || !accessKey || !secretKey) {
this.status = STATUS.NOT_INITIALIZED;
Function up
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable('t_script', {
id: {
allowNull: false,
primaryKey: true,
Function AreaController
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function AreaController(gladys) {
/**
* @api {post} /api/v1/area create
* @apiName create
* @apiGroup Area
Function determineTypeAndTraits
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function determineTypeAndTraits(device) {
const featureCategoryTypes = {};
let type;
const traits = [];
let attributes = {};
Function poll
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function poll(device) {
const externalId = device.external_id;
const [prefix, topic] = device.external_id.split(':');
if (prefix !== 'tuya') {
Function EwelinkController
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function EwelinkController(eweLinkHandler) {
/**
* @api {post} /api/v1/service/ewelink/connect Connect to eWeLink cloud account.
* @apiName save
* @apiGroup Ewelink
Function getAccessToken
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function getAccessToken(refreshToken, scope) {
if (!refreshToken || refreshToken.length === 0) {
throw new BadParameters();
}
const refreshTokenHash = hashRefreshToken(refreshToken);
Function checkForContainerUpdates
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function checkForContainerUpdates(config) {
logger.info('Checking for current installed versions and required updates...');
// Check for MQTT container version
if (config.dockerMqttVersion !== DEFAULT.DOCKER_MQTT_VERSION) {
Function throwErrorIfNeeded
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function throwErrorIfNeeded(response, emit = false, config = false) {
if (response.error) {
if (response.error === 406) {
this.connected = false;
this.accessToken = '';
Function command
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function command(message, classification, context) {
const cameraImages = [];
const roomEntity = classification.entities.find((entity) => entity.entity === 'room');
const deviceEntity = classification.entities.find((entity) => entity.entity === 'device');
Function promise
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const promise = new Promise((resolve, reject) => {
let err = '';
const childProcess = spawn('node', [SCRIPT_PATH, JSON.stringify(params)]);
childProcess.stdout.on('data', async (data) => {
Function getEventsInRange
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getEventsInRange(state, from, to) {
store.setState({
DeviceGetStatus: CalendarGetEventsStatus.Getting
});
try {
Function disarm
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function disarm(selector) {
// In case there is a timeout to arm this house, we clear it
clearTimeout(this.armingHouseTimeout.get(selector));
if (this.armingHouseTimeout.get(selector)) {
this.armingHouseTimeout.delete(selector);
Function createActions
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createActions(store) {
const actions = {
async loadProfilePicture(state) {
// if a profile picture already exist
if (state.profilePicture) {
Function saveNextcloudTalkSettings
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async saveNextcloudTalkSettings(state) {
store.setState({
nextcloudTalkSaveSettingsStatus: RequestStatus.Getting
});
try {
Function saveCaldavSettings
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async saveCaldavSettings(state) {
store.setState({
caldavSaveSyncStatus: CalDAVStatus.Getting
});
try {
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(
props,
{ name, color, radius, latitude, longitude, houses, loading, createAreaError, deleteAreaError, getAreaError }
) {
return (
Similar blocks of code found in 12 locations. Consider refactoring. Open
updateBoxUseCustomValue = e => {
this.props.updateBoxConfig(this.props.x, this.props.y, {
humidity_use_custom_value: e.target.checked
});
};
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 58.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 12 locations. Consider refactoring. Open
updateBoxName = e => {
this.props.updateBoxConfig(this.props.x, this.props.y, {
name: e.target.value
});
};
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 58.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 12 locations. Consider refactoring. Open
updateBoxTitle = e => {
this.props.updateBoxConfig(this.props.x, this.props.y, { title: e.target.value });
};
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 58.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76