@@ -20,13 +20,15 @@ use cairo_lang_filesystem::ids::CrateLongId;
20
20
use cairo_lang_semantic:: db:: PluginSuiteInput ;
21
21
use cairo_lang_semantic:: plugin:: PluginSuite ;
22
22
use cairo_lang_utils:: ordered_hash_map:: OrderedHashMap ;
23
- use cairo_lint_core:: plugin:: CairoLintAllow ;
24
23
use smol_str:: SmolStr ;
25
24
use std:: collections:: HashMap ;
26
25
use std:: path:: PathBuf ;
27
26
use std:: sync:: Arc ;
28
27
use tracing:: trace;
29
28
29
+ #[ cfg( feature = "scarb-lint" ) ]
30
+ use cairo_lint_core:: plugin:: CairoLintAllow ;
31
+
30
32
pub struct ScarbDatabase {
31
33
pub db : RootDatabase ,
32
34
pub proc_macros : Vec < Arc < ProcMacroHostPlugin > > ,
@@ -47,10 +49,7 @@ pub(crate) fn build_scarb_root_database(
47
49
proc_macros,
48
50
} = PluginsForComponents :: collect ( ws, unit) ?;
49
51
50
- plugins
51
- . get_mut ( & unit. main_component ( ) . id )
52
- . unwrap ( )
53
- . add_analyzer_plugin :: < CairoLintAllow > ( ) ;
52
+ append_lint_plugin ( plugins. get_mut ( & unit. main_component ( ) . id ) . unwrap ( ) ) ;
54
53
55
54
let main_component_suite = plugins
56
55
. get_mut ( & unit. main_component ( ) . id )
@@ -72,6 +71,14 @@ pub(crate) fn build_scarb_root_database(
72
71
Ok ( ScarbDatabase { db, proc_macros } )
73
72
}
74
73
74
+ #[ cfg( feature = "scarb-lint" ) ]
75
+ fn append_lint_plugin ( suite : & mut PluginSuite ) {
76
+ suite. add_analyzer_plugin :: < CairoLintAllow > ( ) ;
77
+ }
78
+
79
+ #[ cfg( not( feature = "scarb-lint" ) ) ]
80
+ fn append_lint_plugin ( _suite : & mut PluginSuite ) { }
81
+
75
82
/// Sets the plugin suites for crates related to the library components
76
83
/// according to the `plugins_for_components` mapping.
77
84
fn apply_plugins (
0 commit comments