Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to process cell without semicolon #152

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anutosh491
Copy link
Collaborator

Description

Through this PR I am trying to facilitate returning output while the semicolon is being omitted.

Type of change

Please tick all options which are relevant.

  • Bug fix
  • New feature
  • Added/removed dependencies
  • Required documentation updates

@anutosh491 anutosh491 marked this pull request as draft June 25, 2024 06:06
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

@@ -153,7 +154,9 @@ __get_cxx_version ()
auto errorlevel = 0;
std::string ename;
std::string evalue;
bool compilation_result = false;
//bool compilation_result = false;
intptr_t output_value;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'output_value' is not initialized [cppcoreguidelines-init-variables]

Suggested change
intptr_t output_value;
intptr_t output_value = 0;

************************************************************************************/

#ifndef XCPP_MIME_INTERNAL_HPP
#define XCPP_MIME_INTERNAL_HPP
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: header guard does not follow preferred style [llvm-header-guard]

Suggested change
#define XCPP_MIME_INTERNAL_HPP
#ifndef GITHUB_WORKSPACE_SRC_XMIME_INTERNAL_HPP
#define GITHUB_WORKSPACE_SRC_XMIME_INTERNAL_HPP

xmime_included = true;
}

intptr_t mimeReprV;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'mimeReprV' is not initialized [cppcoreguidelines-init-variables]

Suggested change
intptr_t mimeReprV;
intptr_t mimeReprV = 0;

bool hadError = false;
{
std::ostringstream oss;
oss << reinterpret_cast<void*>(V);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]

            oss << reinterpret_cast<void*>(V);
                   ^

bool hadError = false;
{
std::ostringstream oss;
oss << reinterpret_cast<void*>(V);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]

            oss << reinterpret_cast<void*>(V);
                   ^

}

if (!hadError && mimeReprV != 0) {
return *(nl::json*)mimeReprV;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]

            return *(nl::json*)mimeReprV;
                    ^

}

if (!hadError && mimeReprV != 0) {
return *(nl::json*)mimeReprV;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]

            return *(nl::json*)mimeReprV;
                    ^

return *(nl::json*)mimeReprV;
} else {
return nl::json::object();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not use 'else' after 'return' [llvm-else-after-return]

Suggested change
}
} return nl::json::object();

src/xmime_internal.hpp Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

src/xinterpreter.cpp Outdated Show resolved Hide resolved
src/xinterpreter.cpp Show resolved Hide resolved
src/xparser.cpp Show resolved Hide resolved
src/xparser.cpp Show resolved Hide resolved
if (current != 0)
{
current = 0;
result.push_back("");
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: use emplace_back instead of push_back [modernize-use-emplace]

Suggested change
result.push_back("");
result.emplace_back("");

if (current != 1)
{
current = 1;
result.push_back("");
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: use emplace_back instead of push_back [modernize-use-emplace]

Suggested change
result.push_back("");
result.emplace_back("");

@codecov-commenter
Copy link

codecov-commenter commented Jun 25, 2024

Codecov Report

Attention: Patch coverage is 55.26316% with 34 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@4745f72). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #152   +/-   ##
=======================================
  Coverage        ?   79.82%           
=======================================
  Files           ?       18           
  Lines           ?      684           
  Branches        ?       70           
=======================================
  Hits            ?      546           
  Misses          ?      138           
  Partials        ?        0           
Files Coverage Δ
src/xparser.cpp 88.67% <82.35%> (ø)
src/xinterpreter.cpp 87.87% <60.86%> (ø)
src/xmime_internal.hpp 0.00% <0.00%> (ø)
Files Coverage Δ
src/xparser.cpp 88.67% <82.35%> (ø)
src/xinterpreter.cpp 87.87% <60.86%> (ø)
src/xmime_internal.hpp 0.00% <0.00%> (ø)

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

src/xmime_internal.hpp Outdated Show resolved Hide resolved
src/xmime_internal.hpp Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

inline nl::json mime_repr(intptr_t V)
{
// Return a JSON mime bundle representing the specified value.
void* value_ptr = reinterpret_cast<void*>(V);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]

        void* value_ptr = reinterpret_cast<void*>(V);
                          ^

inline nl::json mime_repr(intptr_t V)
{
// Return a JSON mime bundle representing the specified value.
void* value_ptr = reinterpret_cast<void*>(V);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]

        void* value_ptr = reinterpret_cast<void*>(V);
                          ^


std::string codeString = code.str();

mimeReprV = Cpp::Evaluate(codeString.c_str(), &hadError);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: Value stored to 'mimeReprV' is never read [clang-analyzer-deadcode.DeadStores]

            mimeReprV = Cpp::Evaluate(codeString.c_str(), &hadError);
            ^
Additional context

src/xmime_internal.hpp:50: Value stored to 'mimeReprV' is never read

            mimeReprV = Cpp::Evaluate(codeString.c_str(), &hadError);
            ^

mimeReprV = Cpp::Evaluate(codeString.c_str(), &hadError);
}

void* mimeReprV_ptr = reinterpret_cast<void*>(V);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]

        void* mimeReprV_ptr = reinterpret_cast<void*>(V);
                              ^

mimeReprV = Cpp::Evaluate(codeString.c_str(), &hadError);
}

void* mimeReprV_ptr = reinterpret_cast<void*>(V);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]

        void* mimeReprV_ptr = reinterpret_cast<void*>(V);
                              ^


if (!hadError && mimeReprV_ptr)
{
return *(nl::json*) mimeReprV_ptr;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]

            return *(nl::json*) mimeReprV_ptr;
                    ^

else
{
return nl::json::object();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not use 'else' after 'return' [llvm-else-after-return]

Suggested change
}
return nl::json::object();

std::ostringstream code;
code << "using xcpp::mime_bundle_repr;";
code << "mime_bundle_repr(";
// code << "*(" << getTypeAsString(V);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Commented out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants