File Organization Rules¶
A consistent file and directory structure is crucial for navigating a large codebase. These rules enforce conventions for file naming and location.
Copyright Header¶
FILE_HEADER_COPYRIGHT
Ensures that every source and header file begins with a copyright notice and license information. This is important for legal compliance and clarifying code ownership.
Examples:
✅ Correct
❌ Incorrect (Lint Error)
// Copyright (C) 2025 My Awesome Company Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
// ... rest of file
// No copyright notice at the top of the file.
#pragma once
// ... rest of file
File Naming Convention¶
FILE_NAMING_CONVENTION
Enforces a consistent naming convention for files. Header and source files should use `PascalCase` and have matching names (e.g., `MyClass.h` and `MyClass.cpp`).
Examples:
✅ Correct
❌ Incorrect (Lint Error)
// Consistent PascalCase naming
src/core/DatabaseConnection.h
src/core/DatabaseConnection.cpp
src/utils/StringUtils.h
src/utils/StringUtils.cpp
// Inconsistent naming styles
src/core/database_connection.h // snake_case
src/core/DatabaseConnection.cpp
src/utils/string-utils.h // kebab-case
src/utils/StringUtils.cpp
Summary¶
A well-organized file structure is a sign of a well-organized project:
Copyright First: Ensure all files have proper legal notices.
Consistent Naming: Make files easy to find and identify.