You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Detector does not ignore comments. In my case it identified the word 'if' within a comment as an 'if' statement and as a result reported a cyclomatic complexity error ("Cyclomatic complexity is high (6)").
To Reproduce
Run the detector on the following comment:
// 'src/global.ts' provides helpers for communicating with the application monitor. These are required as it may not have completed loading if we access it during the startup process.".
What is the exact code you are analyzing?
// Dependencies - Vendor
import { createApp } from 'vue';
import { createPinia } from 'pinia';
import { VueQueryPlugin } from '@tanstack/vue-query';
// Dependencies - Framework
import '@/assets/main.scss'; // Global application styles.
import { initTranslations } from '@/locales';
import router from '@/router';
import { handleError, initAppMonitor } from '@/globals';
// Dependencies - Component
import App from '@/App.vue'; // Root component.
// Application - Initialise
try {
// Create a new Vue application instance and register plugins.
const application = createApp(App); // Create the main Vue instance using the root component.
application.use(createPinia()); // Register Pinia for centralized state management. 'useMainStore' in 'src/stores/mainStore.ts' is then available for use.
application.use(VueQueryPlugin); // Register Vue Query for managing data fetching, caching, and synchronization.
application.use(router); // Register the router instance to handle navigation.
// Initialize translations before proceeding with application initialization.
initTranslations(application).then(() => {
try {
// Asynchronously load and initialize the application monitor without blocking application startup.
// 'src/global.ts' provides helpers for communicating with the application monitor. These are required as the monitor may not have completed loading if we access it during the startup process.
// The application monitor is also responsible for asynchronously loading the session manager.
import('@/appMonitor').then((module) => initAppMonitor(module));
application.mount('#app'); // Mount the application to the DOM. This will begin before the application monitor and session manager have completed loading.
} catch (error) {
handleError(error, { locator: 'Application Initialisation [main.2]' }); // Report error during initialisation.
}
});
} catch (error) {
handleError(error, { locator: 'Application Initialisation [main.1]' }); // Report error during initialisation.
}
Actually it should be true to all rules. All comments should be ignored by the rule reporter.
So I changed the issue title.
Something slightly related. @David-Pena what do you think adding a new rule what checks the amount of comments. I guess we have to discuss it on discord,.
rrd108
changed the title
Ignore matches in comments
Ignore rule matches in comments
Sep 14, 2024
Describe the bug
Detector does not ignore comments. In my case it identified the word 'if' within a comment as an 'if' statement and as a result reported a cyclomatic complexity error ("Cyclomatic complexity is high (6)").
To Reproduce
Run the detector on the following comment:
rrd ~ cyclomatic complexity
👉 Try to reduce complexity. See: https://vue-mess-detector.webmania.cc/rules/rrd/cyclomatic-complexity.html
Cyclomatic complexity is high (6) 🚨
Expected behavior
No cyclomatic complexity error/warning. I would expect the detector to ignore comments.
Screenshots
Used version number of vue-mess-detector:
v0.48.0
Used version number of node & yarn:
node:v20.15.0
npm: 10.8.2
Additional context
As discussed on Discord.
The text was updated successfully, but these errors were encountered: