Skip to content

Commit

Permalink
Add codespell spell checker (makefile, CI) (open-telemetry#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
rockdaboot authored and florianl committed Aug 30, 2024
1 parent ac4289e commit b92e124
Show file tree
Hide file tree
Showing 22 changed files with 64 additions and 31 deletions.
4 changes: 4 additions & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ba
fo
opne
optimyze
10 changes: 10 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# https://github.com/codespell-project/codespell
[codespell]
builtin = clear,rare,informal
check-filenames =
check-hidden =
ignore-words = .codespellignore
interactive = 1
skip = .git,AUTHORS.md,go.mod,go.sum,LICENSES,zydis
uri-ignore-words-list = *
write =
16 changes: 16 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: codespell
on:
push:
branches:
- main
pull_request:
jobs:
codespell:
runs-on: ubuntu-latest
steps:
- name: Install codespell
run: sudo apt-get install codespell
- name: Checkout Repo
uses: actions/checkout@v4
- name: Codespell
run: make codespell
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
/go
opentelemetry-ebpf-profiler
ci-kernels

6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.PHONY: all all-common binary clean ebpf generate test test-deps protobuf docker-image agent legal \
integration-test-binaries lint linter-version
integration-test-binaries codespell lint linter-version

SHELL := /usr/bin/env bash

Expand Down Expand Up @@ -114,3 +114,7 @@ legal:
@echo "Dependencies license summary (from deps.profiling-agent.csv):"
@echo " Count License"
@tail -n '+2' deps.profiling-agent.csv | cut -d',' -f5 | sort | uniq -c | sort -k1rn


codespell:
@codespell
2 changes: 1 addition & 1 deletion doc/gopclntab.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ struct runtime_inlinedCall {

This section provides some examples on what structures need to be traversed to
locate various function information. This omits details like relative offsets
that depend on data from the header or moduledata to keep complexity managable.
that depend on data from the header or moduledata to keep complexity manageable.

### Locating `runtime._func` for a PC

Expand Down
2 changes: 1 addition & 1 deletion doc/symb-proto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ frame symbol information are uploaded via `/api/symbols-ranges`. The "return
pads" files that contain leaf frame symbol information are uploaded via
`/api/symbols-returnpads`. Symbfiles may be split and uploaded in multiple
chunks (in separate HTTP requests) for improved load balancing in the presence
of muliple symbolizer services.
of multiple symbolizer services.

### File metadata (request)

Expand Down
4 changes: 2 additions & 2 deletions interpreter/dotnet/dotnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ package dotnet
// with its metadata maps. insert this into ebpf pid_page mappings.
// 2. just use standard frame pointer unwinding in ebpf, and also locate the JIT function
// code header to get access to debug data and method descriptors
// 3. in the host agent, the debug data and method descriptors are resolved and mappped to
// 3. in the host agent, the debug data and method descriptors are resolved and mapped to
// PE (.dll) FileID, Method index, and the IL code offset (JIT code), or the PE FileID
// and Relative Virtual Address (RVA) (Ready to Run code)
// 4. symbolizer can then map the above data to source code file and line
Expand Down Expand Up @@ -128,7 +128,7 @@ var (
// regex for the core language runtime
dotnetRegex = regexp.MustCompile(`/(\d+)\.(\d+).(\d+)/libcoreclr.so$`)

// The FileID used for Dotnet stub frames. Same FileID as in other interpeters.
// The FileID used for Dotnet stub frames. Same FileID as in other interpreters.
stubsFileID = libpf.NewFileID(0x578b, 0x1d)

// compiler check to make sure the needed interfaces are satisfied
Expand Down
4 changes: 2 additions & 2 deletions interpreter/dotnet/method.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (m *dotnetMethod) mapPCOffsetToILOffset(pcOffset uint32, findCall bool) uin
lastCallILOffset = ilOffset
}

// NOTE: _DEBUG builds could have a 0xA nibble to indentify row change.
// NOTE: _DEBUG builds could have a 0xA nibble to identify row change.
log.Debugf(" %3d, native %3d -> IL %#03x, sourceFlags %#x",
i, nativeOffset, ilOffset, sourceFlags)
}
Expand All @@ -116,7 +116,7 @@ func (m *dotnetMethod) dumpBounds() {
nativeOffset += nr.Uint32()
ilOffset := uint32(int32(nr.Uint32()) + mappingTypeMaxValue)
sourceFlags := nr.Uint32()
// NOTE: _DEBUG builds could have a 0xA nibble to indentify row change.
// NOTE: _DEBUG builds could have a 0xA nibble to identify row change.

log.Debugf(" %3d, native %3d -> IL %#03x, sourceFlags %#x",
i, nativeOffset, ilOffset, sourceFlags)
Expand Down
2 changes: 1 addition & 1 deletion interpreter/dotnet/pe.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ type StreamHeader struct {
Size uint32
}

// table* variables are ECMA-335 II.22 defined Metdata table numbers
// table* variables are ECMA-335 II.22 defined Metadata table numbers
const (
tableModule = 0x00
tableTypeRef = 0x01
Expand Down
2 changes: 1 addition & 1 deletion interpreter/hotspot/stubs.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func findStubBounds(vmd *hotspotVMData, bias libpf.Address,
for i := 0; i < len(stubs); i++ {
cur := &stubs[i]

// Some stubs re-use the code from another stub. Skip elements until
// Some stubs reuse the code from another stub. Skip elements until
// we detected the next stub that doesn't occupy the same address.
for i < len(stubs) {
if i != len(stubs)-1 {
Expand Down
2 changes: 1 addition & 1 deletion interpreter/php/decode_amd64.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int retrieveJITBufferPtr(const uint8_t * const code, const size_t codesize,
// which allows us to recover accurate PC data for JIT code
int retrieveExecuteExJumpLabelAddress(const uint8_t * const code, const size_t codesize,
const uint64_t rip_base, uint64_t * const out) {
// The raison d'etre for this function is described in the php8 unwinding doc,
// The purpose of this function is described in the php8 unwinding doc,
// in particular in the "disassembling execute_ex" section.
ZydisDecoder decoder;
ZydisDecoderInit(&decoder, ZYDIS_MACHINE_MODE_LONG_64, ZYDIS_STACK_WIDTH_64);
Expand Down
20 changes: 10 additions & 10 deletions libpf/basehash/hash128_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,23 +136,23 @@ func TestHash128Format(t *testing.T) {
0xCC, 0xDD, 0xEE, 0xFF})

tests := map[string]struct {
formater string
expected string
formatter string
expected string
}{
"v": {formater: "%v", expected: "{4822678189205111 9843086184167632639}"},
"d": {formater: "%d", expected: "{4822678189205111 9843086184167632639}"},
"x": {formater: "%x", expected: "112233445566778899aabbccddeeff"},
"X": {formater: "%X", expected: "112233445566778899AABBCCDDEEFF"},
"#v": {formater: "%#v", expected: "0x112233445566778899aabbccddeeff"},
"#x": {formater: "%#x", expected: "0x112233445566778899aabbccddeeff"},
"#X": {formater: "%#X", expected: "0x112233445566778899AABBCCDDEEFF"},
"v": {formatter: "%v", expected: "{4822678189205111 9843086184167632639}"},
"d": {formatter: "%d", expected: "{4822678189205111 9843086184167632639}"},
"x": {formatter: "%x", expected: "112233445566778899aabbccddeeff"},
"X": {formatter: "%X", expected: "112233445566778899AABBCCDDEEFF"},
"#v": {formatter: "%#v", expected: "0x112233445566778899aabbccddeeff"},
"#x": {formatter: "%#x", expected: "0x112233445566778899aabbccddeeff"},
"#X": {formatter: "%#X", expected: "0x112233445566778899AABBCCDDEEFF"},
}

for name, test := range tests {
name := name
test := test
t.Run(name, func(t *testing.T) {
output := fmt.Sprintf(test.formater, h)
output := fmt.Sprintf(test.formatter, h)
assert.Equal(t, test.expected, output)
})
}
Expand Down
2 changes: 1 addition & 1 deletion libpf/pfelf/pfelf.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

// SafeOpenELF opens the given ELF file in a safely way in that
// it recovers from panics inside elf.Open().
// Under cirumstances we see fatal errors from inside the runtime, which
// Under circumstances we see fatal errors from inside the runtime, which
// are not recoverable, e.g. "fatal error: runtime: out of memory".
func SafeOpenELF(name string) (elfFile *elf.File, err error) {
defer func() {
Expand Down
2 changes: 1 addition & 1 deletion maccess/maccess_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func CopyFromUserNoFaultIsPatched(codeblob []byte, _, _ uint64) (bool, error) {
// 0 otherwise
// - C
// 1 if CMP results in carry condition, like unsigned overflow
// 0 otherweise
// 0 otherwise
expectedInstructionTracker ^= stepB
continue
}
Expand Down
2 changes: 1 addition & 1 deletion periodiccaller/periodiccaller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func isSelfOrRuntime(t *testing.T, stack *[32]uintptr, self string) bool {
if funcName == self {
return true
}
// Go runtime specifc filters
// Go runtime specific filters
if !strings.HasPrefix(funcName, "runtime.") &&
!strings.HasPrefix(funcName, "runtime/") &&
!strings.HasPrefix(funcName, "testing.") &&
Expand Down
2 changes: 1 addition & 1 deletion reporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Config struct {
// Name defines the name of the agent.
Name string

// Version defines the vesion of the agent.
// Version defines the version of the agent.
Version string

// CollAgentAddr defines the destination of the backend connection.
Expand Down
2 changes: 1 addition & 1 deletion support/ebpf/native_stack_trace.ebpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ static inline ErrorCode copy_state_regs(UnwindState *state,
// https://github.com/torvalds/linux/blob/2ef5971ff3/arch/x86/entry/entry_64.S#L847
state->return_address = interrupted_kernelmode && regs->orig_ax != -1;
#elif defined(__aarch64__)
// For backwards compatability aarch64 can run 32-bit code.
// For backwards compatibility aarch64 can run 32-bit code.
// Check if the process is running in this 32-bit compat mod.
if (regs->pstate & PSR_MODE32_BIT) {
return ERR_NATIVE_AARCH64_32BIT_COMPAT_MODE;
Expand Down
2 changes: 1 addition & 1 deletion support/ebpf/php_tracer.ebpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int process_php_frame(PerCPURecord *record, PHPProcInfo *phpinfo, bool is_jitted
}

// Get execute_data->This.type_info. This reads into the `type_info` argument
// so we can re-use it in walk_php_stack
// so we can reuse it in walk_php_stack
if (bpf_probe_read_user(type_info, sizeof(u32),
execute_data + phpinfo->zend_execute_data_this_type_info)) {
DEBUG_PRINT("Failed to read execute_data->This.type_info (0x%lx)",
Expand Down
4 changes: 2 additions & 2 deletions support/ebpf/tracemgmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ bool pid_event_ratelimit(u32 pid, int ratelimit_action) {

// Update the map entry. Technically this is not SMP safe, but doing
// an atomic update would require EBPF atomics. At worst we send an
// extra sync event and the likelyhood for this race is very low, so
// extra sync event and the likelihood for this race is very low, so
// we can live with this.
int err = bpf_map_update_elem(&reported_pids, &pid, &token, BPF_ANY);
if (err != 0) {
Expand Down Expand Up @@ -314,7 +314,7 @@ static bool is_kernel_address(u64 addr) {

// resolve_unwind_mapping decodes the current PC's mapping and prepares unwinding information.
// The state text_section_id and text_section_offset are updated accordingly. The unwinding program
// index that should be used is writen to the given `unwinder` pointer.
// index that should be used is written to the given `unwinder` pointer.
static ErrorCode resolve_unwind_mapping(PerCPURecord *record, int* unwinder) {
UnwindState *state = &record->state;
pid_t pid = record->trace.pid;
Expand Down
2 changes: 1 addition & 1 deletion support/ebpf/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ typedef struct RubyUnwindState {
typedef struct DotnetUnwindScratchSpace {
// Buffer to read nibble map to locate code start. One map entry allows seeking backwards
// 32*8 = 256 bytes of code. This defines the maximum size for a JITted function we
// can reconize: 256 bytes/element * 128 elements = 32kB function size.
// can recognize: 256 bytes/element * 128 elements = 32kB function size.
u32 map[128];
// Extra space to read to map fixed amount of bytes, but to dynamic offset.
u32 extra[128];
Expand Down
2 changes: 1 addition & 1 deletion tools/coredump/testsources/node/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const notifyWaiter = (id) => {
setTimeout(() => {
console.log(`Order for customer at table #${id} processed....`);
resolve({ customerId: id, customerOrder: "Pizza" });
// reject(new Error("Error occured with waiter"));
// reject(new Error("Error occurred with waiter"));
}, 1);
});
}
Expand Down

0 comments on commit b92e124

Please sign in to comment.