mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-03-30 13:43:26 +08:00
fix: harden unicode safety checks
This commit is contained in:
@@ -26,22 +26,22 @@ Standards for readable, maintainable Java (17+) code in Spring Boot services.
|
||||
## Naming
|
||||
|
||||
```java
|
||||
// ✅ Classes/Records: PascalCase
|
||||
// PASS: Classes/Records: PascalCase
|
||||
public class MarketService {}
|
||||
public record Money(BigDecimal amount, Currency currency) {}
|
||||
|
||||
// ✅ Methods/fields: camelCase
|
||||
// PASS: Methods/fields: camelCase
|
||||
private final MarketRepository marketRepository;
|
||||
public Market findBySlug(String slug) {}
|
||||
|
||||
// ✅ Constants: UPPER_SNAKE_CASE
|
||||
// PASS: Constants: UPPER_SNAKE_CASE
|
||||
private static final int MAX_PAGE_SIZE = 100;
|
||||
```
|
||||
|
||||
## Immutability
|
||||
|
||||
```java
|
||||
// ✅ Favor records and final fields
|
||||
// PASS: Favor records and final fields
|
||||
public record MarketDto(Long id, String name, MarketStatus status) {}
|
||||
|
||||
public class Market {
|
||||
@@ -54,10 +54,10 @@ public class Market {
|
||||
## Optional Usage
|
||||
|
||||
```java
|
||||
// ✅ Return Optional from find* methods
|
||||
// PASS: Return Optional from find* methods
|
||||
Optional<Market> market = marketRepository.findBySlug(slug);
|
||||
|
||||
// ✅ Map/flatMap instead of get()
|
||||
// PASS: Map/flatMap instead of get()
|
||||
return market
|
||||
.map(MarketResponse::from)
|
||||
.orElseThrow(() -> new EntityNotFoundException("Market not found"));
|
||||
@@ -66,13 +66,13 @@ return market
|
||||
## Streams Best Practices
|
||||
|
||||
```java
|
||||
// ✅ Use streams for transformations, keep pipelines short
|
||||
// PASS: Use streams for transformations, keep pipelines short
|
||||
List<String> names = markets.stream()
|
||||
.map(Market::name)
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
|
||||
// ❌ Avoid complex nested streams; prefer loops for clarity
|
||||
// FAIL: Avoid complex nested streams; prefer loops for clarity
|
||||
```
|
||||
|
||||
## Exceptions
|
||||
|
||||
Reference in New Issue
Block a user