Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
---
applyTo: "**"
---
# GitHub Copilot Instructions for HPCC Platform

## Repository Structure
Expand All @@ -15,26 +12,19 @@ This repository contains **two distinct projects**:
### Build System
- **Build tool**: CMake with Ninja generator
- **Configuration**: Use options from `vcpkg-linux.code-workspace`
- **Key cmake arguments**:
```
-DCONTAINERIZED=OFF
-DUSE_OPTIONAL=OFF
-DUSE_CPPUNIT=ON
-DINCLUDE_PLUGINS=ON
-DSUPPRESS_V8EMBED=ON
-DSUPPRESS_REMBED=ON
```
- **Key cmake arguments**: deduce cmake arguments from .vscode/settings.json

### Build Commands
- **Build directory** (<build-dir>): Extract the current setting from "cmake.buildDirectory" in .vscode/settings.json which is based on $buildType
```bash
# Configure the build
cmake -B ./build -S . -G Ninja -DCONTAINERIZED=OFF -DUSE_OPTIONAL=OFF -DUSE_CPPUNIT=ON -DINCLUDE_PLUGINS=ON -DSUPPRESS_V8EMBED=ON -DSUPPRESS_REMBED=ON -DCMAKE_BUILD_TYPE=Debug
cmake -B <build-dir> -S . -G Ninja -DCONTAINERIZED=OFF -DUSE_OPTIONAL=OFF -DUSE_CPPUNIT=ON -DINCLUDE_PLUGINS=ON -DSUPPRESS_V8EMBED=ON -DSUPPRESS_REMBED=ON -DCMAKE_BUILD_TYPE=Debug

# Build
cmake --build ./build --parallel
cmake --build <build-dir> --parallel

# Create package
cmake --build ./build --parallel --target package
cmake --build <build-dir> --parallel --target package
```

### Key Directories
Expand All @@ -53,6 +43,15 @@ cmake --build ./build --parallel --target package
- Follow the style guide in `devdoc/StyleGuide.md`
- Review guidelines in `devdoc/CodeReviews.md`
- Submission process in `devdoc/CodeSubmissions.md`
- Never add trailing whitespace, be careful when copying code from other sources
- Use Allman style for C++ code blocks
- Do not use brace curly blocks for single line blocks, unless they are nested
- Use camel case for variable names
- Use constexpr's for constances not macros
- Use Owned vs Linked for assigning ownership of objects
- Avoid default parameters in function declarations (overload methods with different prototypes instead)
- Use `#pragma once` for header guards
- Use %u for unsigned integers, %d for signed integers

### Development Workflow
- See `devdoc/Development.md` for testing and development guidelines
Expand All @@ -66,3 +65,11 @@ For the ECL Watch web interface, see the separate instructions in `esp/src/.gith
## Documentation
- Contributing docs: `devdoc/docs/ContributeDocs.md`
- GitHub Copilot tips: `devdoc/userdoc/copilot/CopilotPromptTips.md`

## When performing a code review
- Follow the guidelines in `devdoc/CodeReviews.md`
- Pay particular attention to the following questions:
- Are there any efficiency concerns?
- Is the code thread safe?
- Could the code be refactored to improve maintainability and reuse?
- Are there any memory or resource leaks?
25 changes: 25 additions & 0 deletions dali/daliadmin/daliadmin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,31 @@ int main(int argc, const char* argv[])
return -1;
}

unsigned *myvariablename = new unsigned;
*myvariablename = 10000;
printf("%d\n", *myvariablename);
Copy link

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The format specifier %d is for signed integers; for an unsigned value use %u to ensure correct output and defined behavior.

Suggested change
printf("%d\n", *myvariablename);
printf("%u\n", *myvariablename);

Copilot uses AI. Check for mistakes.

unsigned __int64 sum = 0;
// sum up all the numbers from 0 to 9999
for (unsigned x=0; x<*myvariablename; x++)
{
sum += x;
}
printf("%llu\n", sum);
Copy link

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using %llu assumes unsigned long long; for portability with unsigned __int64, consider using the PRIu64 macro or matching the exact type’s specifier.

Copilot uses AI. Check for mistakes.
sum = 0;
// sum up all the numbers from 0 to 9999 N times
for (unsigned x=0; x<*myvariablename; x++)
{
for (unsigned y=0; y<*myvariablename; y++)
Comment on lines +151 to +166
Copy link

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dynamically allocated unsigned is never freed, causing a memory leak. Consider using a stack variable or managing its lifetime to ensure delete is called.

Suggested change
unsigned *myvariablename = new unsigned;
*myvariablename = 10000;
printf("%d\n", *myvariablename);
unsigned __int64 sum = 0;
// sum up all the numbers from 0 to 9999
for (unsigned x=0; x<*myvariablename; x++)
{
sum += x;
}
printf("%llu\n", sum);
sum = 0;
// sum up all the numbers from 0 to 9999 N times
for (unsigned x=0; x<*myvariablename; x++)
{
for (unsigned y=0; y<*myvariablename; y++)
unsigned myvariablename;
myvariablename = 10000;
printf("%d\n", myvariablename);
unsigned __int64 sum = 0;
// sum up all the numbers from 0 to 9999
for (unsigned x=0; x<myvariablename; x++)
{
sum += x;
}
printf("%llu\n", sum);
sum = 0;
// sum up all the numbers from 0 to 9999 N times
for (unsigned x=0; x<myvariablename; x++)
{
for (unsigned y=0; y<myvariablename; y++)

Copilot uses AI. Check for mistakes.
Comment on lines +151 to +166
Copy link

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Instead of dynamically allocating a single unsigned, declare it as a local variable (e.g., unsigned myVariableName = 10000;).

Suggested change
unsigned *myvariablename = new unsigned;
*myvariablename = 10000;
printf("%d\n", *myvariablename);
unsigned __int64 sum = 0;
// sum up all the numbers from 0 to 9999
for (unsigned x=0; x<*myvariablename; x++)
{
sum += x;
}
printf("%llu\n", sum);
sum = 0;
// sum up all the numbers from 0 to 9999 N times
for (unsigned x=0; x<*myvariablename; x++)
{
for (unsigned y=0; y<*myvariablename; y++)
unsigned myvariablename = 10000;
printf("%d\n", myvariablename);
unsigned __int64 sum = 0;
// sum up all the numbers from 0 to 9999
for (unsigned x=0; x<myvariablename; x++)
{
sum += x;
}
printf("%llu\n", sum);
sum = 0;
// sum up all the numbers from 0 to 9999 N times
for (unsigned x=0; x<myvariablename; x++)
{
for (unsigned y=0; y<myvariablename; y++)

Copilot uses AI. Check for mistakes.
{
// nested loop
sum += x;
}
}
printf("%llu\n", sum);
Comment on lines +164 to +172
Copy link

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This nested loop results in O(n²) complexity and may impact performance for large values. Consider whether the double summation is necessary or can be optimized.

Suggested change
for (unsigned x=0; x<*myvariablename; x++)
{
for (unsigned y=0; y<*myvariablename; y++)
{
// nested loop
sum += x;
}
}
printf("%llu\n", sum);
// Calculate the sum directly using a mathematical formula
sum = *myvariablename * ((*myvariablename - 1) * *myvariablename / 2);
// The formula computes the sum of x repeated *myvariablename times for all x from 0 to *myvariablename - 1
printf("%llu\n", sum);
printf("%llu\n", sum);

Copilot uses AI. Check for mistakes.



Owned<IPropertyTree> globals = loadConfiguration(defaultYaml, argv, "daliadmin", "DALIADMIN", "daliadmin.xml", nullptr, nullptr, false);
Owned<IProperties> props = createProperties("daliadmin.ini");
StringArray params;
Expand Down
2 changes: 2 additions & 0 deletions devdoc/StyleGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,5 @@ MORE!

Requiring more work: \* namespaces \* STL \* c++11 \* Review all
documentation \* Better examples for shared


Loading