Showing 13 of 49 total issues
Function SlackTriggerDispatcher
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
const SlackTriggerDispatcher = async (relays, event, authedUsers) => {
for (const relay of relays) {
for (const participantApp of relay.participantApps) {
if (participantApp.eventType === 'Trigger') {
const authDetails = await getCredentialsFromAuthedApps(participantApp.authentication);
- 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 RelaySelection
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
const RelaySelection = ({ appData }) => {
const { relayData, storeRelayData } = useRelays();
const appNames = appData.map((app) => app.AppName);
appNames.unshift('Select');
const [triggers, setTriggers] = useState({ slackTriggers: [], githubTriggers: [] });
- 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 performGithubActionOnSlackTrigger
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
const performGithubActionOnSlackTrigger = async (event, authenticatedUser) => {
const action = convertArgsStringToObject(event.text)._[0].split(':')[1];
const authorizedSlackApp = await AuthorizedApps.findOne({ appName: 'Slack', 'credentials.slackUserId': authenticatedUser[0] }).lean();
const authorizedGithubApp = await AuthorizedApps.findOne({ appName: 'Github', userId: authorizedSlackApp.userId }).lean();
const messageConfig = { channel: event.channel, token: authorizedSlackApp.authToken };
Function TaskHistory
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const TaskHistory = () => {
const [taskHistory, setTaskHistory] = useState([]);
const [relays, setRelays] = useState([]);
const getTaskHistory = async () => {
Function SlackActionPerformer
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const SlackActionPerformer = async (relayId, action, triggerEvent) => {
for (const slackEvent of IntegrationConfig.Slack.Events) {
if (slackEvent.EventName === action.event) {
const authDetails = await getCredentialsFromAuthedApps(action.authentication);
const token = authDetails.authToken;
- 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 Form
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Form = (props) => {
const refs = [];
const onSubmit = (event) => {
props.onClick(event, ...refs);
props.history.push('/dashboard');
Function SlackActionPerformer
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SlackActionPerformer = async (relayId, action, triggerEvent) => {
for (const slackEvent of IntegrationConfig.Slack.Events) {
if (slackEvent.EventName === action.event) {
const authDetails = await getCredentialsFromAuthedApps(action.authentication);
const token = authDetails.authToken;
Function createPages
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createPages = (...args) => {
const [handlePageNav, pagesPerList, pageList, currentPage, pages] = args;
const items = [];
const children = '...';
[1, 2, 3].forEach((number) => {
Function HeaderRigth
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const HeaderRigth = () => {
if (auth.isAuthenticated) {
return (
<UncontrolledDropdown>
<DropdownToggle caret color="primary" className="mr-5">
Avoid deeply nested control flow statements. Open
if (inputMatch) {
ActionPerformer.ActionPerformer(relay, event);
}
Avoid deeply nested control flow statements. Open
for (const [inputName, inputValue] of participantApp.inputs) {
if (event[inputName] !== inputValue) {
inputMatch = false;
}
}
Function CreateConfiguration
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const CreateConfiguration = ({
apps, trigger, action, triggerAccount, actionAccount,
}) => {
const { relayData, storeRelayData } = useRelays();
const [triggerFields, setTriggerFields] = useState({});
- 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 getFromConfig
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const getFromConfig = async (req) => {
const {
AppName,
EventName,
DetailName,
- 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"