Skip to content

Commit ce9210c

Browse files
authored
Merge pull request #74 from RelationalAI-oss/revert-71-auto_hash_equals_debug
Revert "Auto hash equals debug"
2 parents bd00f81 + 4c89850 commit ce9210c

3 files changed

Lines changed: 3 additions & 30 deletions

File tree

src/linting/extended_checks.jl

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -993,25 +993,16 @@ function check(t::MissingAutoHashEqualsRule, x::EXPR, markers::Dict{Symbol,Strin
993993
contains(markers[:filename], "test.jl") && return
994994
end
995995

996-
# Check if there's an @auto_hash_equals macro before this struct
997-
if haskey(markers, :macrocall) && markers[:macrocall] == "@auto_hash_equals"
998-
return
999-
end
1000-
1001996
# Get the struct name
1002997
struct_name = fetch_value(x, :IDENTIFIER)
1003998
isnothing(struct_name) && return
1004999

10051000
# Skip private structs (start with underscore)
10061001
startswith(struct_name, "_") && return
10071002

1008-
# Check if it's a mutable struct
1009-
# Mutable struct AST: [1] = MUTABLE keyword, [2] = STRUCT keyword, length = 6
1010-
# Immutable struct AST: [1] = STRUCT keyword, [2] = FALSE, length = 5
1011-
if length(x) >= 1 && headof(x[1]) === :MUTABLE
1012-
# Skip mutable structs - they shouldn't use @auto_hash_equals
1013-
return
1014-
end
1003+
# Check if there's an @auto_hash_equals macro before this struct
1004+
# This is a simplified check - in practice, we'd need to track macros in markers
1005+
# For now, emit a recommendation for all non-private structs
10151006

10161007
msg = "Consider using `@auto_hash_equals` for struct `$(struct_name)` if it will be used as a dictionary key or set member. Skip this if the struct is a bits type or requires custom equality. [Explanation](https://github.com/RelationalAI/RAIStyle#struct-equality)"
10171008

test/fixtures/new_rule_valid.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ struct _PrivateStruct # Private structs (prefix _) don't need it
4141
x::Int
4242
end
4343

44-
mutable struct MutablePoint # Mutable structs don't need it
45-
x::Int
46-
y::Int
47-
end
48-
4944
# NotFullyParameterizedConstructorRule - valid pattern
5045
function process_data_correctly(items)
5146
results = []

test/test_new_rules.jl

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ end
6868
y::Int
6969
end
7070
"""
71-
@test lint_test(code1, "Line 1, column 1: Consider using `@auto_hash_equals` for struct `Point`")
7271

7372
# Should NOT trigger - has @auto_hash_equals
7473
code2 = """
@@ -77,8 +76,6 @@ end
7776
y::Int
7877
end
7978
"""
80-
@test !lint_has_error_test(code2)
81-
8279

8380
# Should NOT trigger - private struct
8481
code3 = """
@@ -87,16 +84,6 @@ end
8784
y::Int
8885
end
8986
"""
90-
@test !lint_has_error_test(code3)
91-
92-
# Should NOT trigger - mutable
93-
code4 = """
94-
mutable struct MutablePoint
95-
x::Int
96-
y::Int
97-
end
98-
"""
99-
@test !lint_has_error_test(code4)
10087
end
10188

10289
@testset "NotFullyParameterizedConstructorRule" begin

0 commit comments

Comments
 (0)