-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fiqare secmotic rules #411
base: master
Are you sure you want to change the base?
Changes from 7 commits
3e79647
85f7388
da9359c
a2e11f6
46f6126
2e0a51d
662a458
9dfbdcb
484e833
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,7 @@ function handleError(error, req, res, next) { | |
name: error.name, | ||
message: error.message | ||
}); | ||
next(); | ||
} | ||
|
||
function parseData(req, res, next) { | ||
|
@@ -159,7 +160,7 @@ function returnCommands(req, res, next) { | |
updates = commandList.map(createCommandUpdate); | ||
cleanCommands = commandList.map(cleanCommand); | ||
|
||
async.parallel(updates.concat(cleanCommands), function(error, results) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case the fix should be to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case we continue to rely on ISO 25010 to improve software quality. Mainly: Rule 1: Unused function parameters should be removed, based on:
So, this is fixed in a2e11f6 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We agree that unused parameters should be avoided. However, we are proposing a different solution for this case: instead of removing the unused What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the maintainability axis of ISO 25010, I think it is counterproductive to add code to the function to use a variable that is currently deprecated, which makes it less readable. Therefore, before adding code that will not be functional, I prefer to leave the function as it was, with the variable "results". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed in 9dfbdcb |
||
async.parallel(updates.concat(cleanCommands), function(error) { | ||
if (error) { | ||
// prettier-ignore | ||
config.getLogger().error( | ||
|
@@ -203,6 +204,7 @@ function returnCommands(req, res, next) { | |
} else { | ||
res.status(200).send(''); | ||
} | ||
next(); | ||
} | ||
|
||
function handleIncomingMeasure(req, res, next) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,10 +112,9 @@ function manageConfigurationRequest(apiKey, deviceId, device, objMessage) { | |
* @param {String} apikey APIKey of the service the device belongs to. | ||
* @param {Array} previous Array of prepared functions that send information to the Context Broker. | ||
* @param {Object} current Information sent by the device. | ||
* @param {Number} index Index of the group in the array. | ||
* @return {Array} Updated array of functions. | ||
*/ | ||
function processMeasureGroup(device, apikey, previous, current, index) { | ||
function processMeasureGroup(device, apikey, previous, current) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JavaDoc entry for index (L115) should be removed also. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed in 662a458 |
||
var values = []; | ||
|
||
if (current.command) { | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -154,6 +154,10 @@ function mergeDeviceWithConfiguration(deviceData, configuration, callback) { | |||||
deviceData[fields[i]] = configuration[confField]; | ||||||
} else if (!deviceData[fields[i]] && (!configuration || !configuration[confField])) { | ||||||
deviceData[fields[i]] = defaults[i]; | ||||||
} else { | ||||||
config | ||||||
.getLogger() | ||||||
.debug(context, 'at field "' + fields[i] + '" configuration merging logic did not merge anything', i); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
not fully sure but I'd say that if you don't use formating (such as "%d") then the i variable should not be included at the end of the statement. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed in 9dfbdcb |
||||||
} | ||||||
|
||||||
if (deviceData[fields[i]] && ['active', 'lazy', 'commands'].indexOf(fields[i]) >= 0) { | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the PR is almost ready (good work! :). However, you should include an entry in the CHANGES_NEXT_RELEASE file in describing the changes. Maybe something like the following:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 484e833