Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# clang-format configuration for pjson.
# Tuned to match the existing hand-written style so applying it is low-churn:
# 4-space indentation, members indented inside the namespace, pointers bound to
# the type, and constructor initializer lists broken before the comma.
---
Language: Cpp
BasedOnStyle: LLVM
Standard: c++11

# Indentation
IndentWidth: 4
TabWidth: 4
UseTab: Never
ContinuationIndentWidth: 4
NamespaceIndentation: All
AccessModifierOffset: -4
IndentCaseLabels: true

# Braces / wrapping
ColumnLimit: 100
BreakBeforeBraces: Attach
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false

# Pointers / references bind to the type: `pjson* p`, `const std::string& s`.
PointerAlignment: Left

# Constructor initializer lists: one per line, comma first (matches the source).
BreakConstructorInitializers: BeforeComma
ConstructorInitializerIndentWidth: 8
PackConstructorInitializers: Never

# Misc
SortIncludes: CaseInsensitive
SpaceAfterCStyleCast: false
FixNamespaceComments: true
MaxEmptyLinesToKeep: 1
KeepEmptyLinesAtTheStartOfBlocks: false
49 changes: 49 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# clang-tidy configuration for pjson.
#
# build.sh promotes enabled findings to errors so regressions fail CI. The check
# set favors real bugs and portability over stylistic noise.
#
# A few checks are disabled deliberately:
# *-magic-numbers the parser/base64 tables are inherently numeric
# *-avoid-c-arrays the static lookup tables are C arrays on purpose
# *-else-after-return the existing style uses else-after-return freely
# *-braces-around-statements matches the compact single-line style
# *-macro-usage the value-array setter/append macros are intentional
# *-exception-escape iterative teardown (dtor/move) uses a heap
# work-list whose push_back may throw bad_alloc;
# terminating on OOM during teardown is intended
# performance-noexcept-move-constructor
# cross-allocator move assignment may allocate and
# deliberately provides the strong guarantee
Checks: >
bugprone-*,
performance-*,
portability-*,
clang-analyzer-*,
misc-*,
modernize-use-nullptr,
modernize-use-override,
readability-misleading-indentation,
readability-non-const-parameter,
-bugprone-easily-swappable-parameters,
-bugprone-signed-char-misuse,
-bugprone-exception-escape,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
-misc-const-correctness,
-misc-include-cleaner,
-performance-enum-size,
-performance-noexcept-move-constructor,
-cppcoreguidelines-*,
-readability-magic-numbers,
-readability-braces-around-statements,
-readability-else-after-return,
-modernize-avoid-c-arrays,
-cppcoreguidelines-avoid-magic-numbers

WarningsAsErrors: ''

# Only lint this project's own headers, not system/STL headers pulled in.
HeaderFilterRegex: 'pjson(lib|test)/'

FormatStyle: file
86 changes: 86 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# SPDX-FileCopyrightText: 2026 ByteDance Ltd. and/or its affiliates
# SPDX-License-Identifier: Apache-2.0

name: Bug report
description: Report reproducible incorrect behavior in pjson
title: "[Bug]: "
body:
- type: markdown
attributes:
value: |
Thanks for helping improve pjson. Search existing issues before filing a
report. For a suspected vulnerability, stop here and follow SECURITY.md
instead of posting details publicly.

- type: input
id: version
attributes:
label: pjson version
description: Provide a release version, tag, or full commit hash.
placeholder: "1.0.0 or commit abcdef1234..."
validations:
required: true

- type: textarea
id: behavior
attributes:
label: What happened?
description: Describe the actual behavior and the result you expected.
placeholder: |
Actual behavior:
Expected behavior:
validations:
required: true

- type: textarea
id: reproduction
attributes:
label: Minimal reproduction
description: Provide the smallest complete program or input that reproduces the problem.
render: cpp
validations:
required: true

- type: textarea
id: environment
attributes:
label: Environment
description: >-
Include the OS, architecture, compiler and version, CMake version, and
relevant build flags.
placeholder: |
OS and architecture:
Compiler and version:
CMake version:
Build type and flags:
validations:
required: true

- type: textarea
id: logs
attributes:
label: Logs and diagnostics
description: >-
Paste relevant compiler output, sanitizer reports, stack traces, or
parser errors. Remove secrets and personal data.
render: shell

- type: textarea
id: context
attributes:
label: Additional context
description: Add anything else that may help, such as a regression range or workaround.

- type: checkboxes
id: checks
attributes:
label: Pre-submission checklist
options:
- label: I searched existing issues for the same problem.
required: true
- label: I can reproduce this with a supported version or the current `main` branch.
required: true
- label: >-
This report does not contain confidential vulnerability details,
credentials, personal data, or other secrets.
required: true
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: 2026 ByteDance Ltd. and/or its affiliates
# SPDX-License-Identifier: Apache-2.0

blank_issues_enabled: false
contact_links:
- name: Report a Code of Conduct incident
url: https://github.com/Pico-Developer/pjson/security/advisories/new
about: Contact maintainers privately and identify the report as a conduct incident.
- name: Report a security vulnerability
url: https://github.com/Pico-Developer/pjson/security/advisories/new
about: Report suspected vulnerabilities privately; do not open a public issue.
- name: Read the documentation
url: https://github.com/Pico-Developer/pjson/tree/main/docs
about: Check the tutorials and usage guidance before filing an issue.
71 changes: 71 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# SPDX-FileCopyrightText: 2026 ByteDance Ltd. and/or its affiliates
# SPDX-License-Identifier: Apache-2.0

name: Feature request
description: Propose a new capability or a deliberate behavior change
title: "[Feature]: "
body:
- type: markdown
attributes:
value: |
Please describe the user problem before prescribing an API. Significant
changes should be discussed before implementation.

- type: textarea
id: problem
attributes:
label: Problem and motivation
description: What use case is difficult or impossible today, and who is affected?
validations:
required: true

- type: textarea
id: proposal
attributes:
label: Proposed solution
description: >-
Describe the behavior or API you would like and include a short usage
example where useful.
validations:
required: true

- type: textarea
id: alternatives
attributes:
label: Alternatives considered
description: Describe current workarounds and other designs you considered.
validations:
required: true

- type: dropdown
id: compatibility
attributes:
label: Compatibility impact
description: >-
Select the closest expected impact; maintainers will make the final
versioning decision.
options:
- Backward-compatible addition
- Behavior change with compatibility risk
- Breaking API or ABI change
- Unsure
validations:
required: true

- type: textarea
id: context
attributes:
label: Additional context
description: >-
Add links, prior art, performance data, or constraints such as C++11
and supported toolchains.

- type: checkboxes
id: checks
attributes:
label: Pre-submission checklist
options:
- label: I searched existing issues for similar requests.
required: true
- label: I described the underlying use case, not only a preferred implementation.
required: true
37 changes: 37 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!-- SPDX-FileCopyrightText: 2026 ByteDance Ltd. and/or its affiliates -->
<!-- SPDX-License-Identifier: Apache-2.0 -->

## Summary

<!-- Explain what changed and why. Keep unrelated changes in separate PRs. -->

## Related issue

<!-- Link an issue or explain why one is not needed. Use "Closes #123" when appropriate. -->

## Verification

<!-- List the exact commands and relevant environments used to verify this change. -->

```text
./build.sh --all
```

## Compatibility and risk

<!--
Note API, ABI, behavior, performance, security, and packaging effects. Write
"None" where appropriate.
-->

## Checklist

- [ ] I have read and followed `CONTRIBUTING.md`.
- [ ] The change is focused and includes tests for new behavior and edge cases.
- [ ] I updated user documentation for public API or behavior changes.
- [ ] I added a concise `CHANGELOG.md` entry when the change is notable to users.
- [ ] I preserved C++11 compatibility and introduced no new dependency, or I
clearly justified the exception.
- [ ] I ran the relevant checks and recorded them above.
- [ ] I have the right to submit this contribution under the project's
Apache-2.0 contribution terms.
Loading
Loading