我正在使用 combineReducer 像这样组合 reducer 和 reducer
const todo = (state = {}, action) => {
switch (action.type) {
//...
case 'TOGGLE_TODO':
if (state.id !== action.id) {
return state
}
return Object.assign({}, state, {
completed: !state.completed
})
default:
return state
}
}
我的问题是,如果我像那样定义 reducer,我会闻到 Sonar 代码的味道
Function parameters with default values should be last1
但仅在此序列中组合 reducer 传递参数如何处理?
最佳答案
我们的项目中确实遇到了同样的问题,sonar 允许您在 Administration -> Congifuration -> Analysis Scope
中定义规则和文件的排除项。
您会发现那里有一个名为 Ignore issues on Multiple Criteria
的部分,您可以在其中输入规则和“文件模式”以从该规则中排除文件。
关于javascript - combineReducer 中使用的 reducer 的 Sonar 代码气味,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53628714/